Error codes
One page per diagnostic code: the message, what it means, a minimal example and how to fix it. Codes and messages match tsc 7.0.2, so a page here also explains the same error from tsc.
ts-r can report 350 diagnostic codes today (cargo xtask diag-codes lists them from the source). This first pass documents 249 of them, plus 45 sound-mode codes. This pass picks the codes that turn up most: first those ts-r-check reports on private-app (all 25 tsconfig projects, run on 2026-10-15 at commit 6deaf01) and those behind failure causes in the ecosystem run of the top 1,000 npm packages (2026-10-14), then the rest by how often tsc 7.0.2's own test baselines report them. All TS8xxx and TS99xxx codes are included.
Every example was run through ts-r-check and is shown only if ts-r reported the page’s code; 237 pages have one. Pages without an example are codes we couldn’t trigger with a minimal input yet.
TypeScript codes
Codes ts-r reports with tsc 7’s code and message.
TS1002Unterminated string literal.TS1003Identifier expected.TS1005'…' expected.TS1011An element access expression should take an argument.TS1013A rest parameter or binding pattern may not have a trailing comma.TS1028Accessibility modifier already seen.TS1029'…' modifier must precede '…' modifier.TS1030'…' modifier already seen.TS1042'…' modifier cannot be used here.TS1044'…' modifier cannot appear on a module or namespace element.TS1068Unexpected token. A constructor, method, accessor, or property was expected.TS1070'…' modifier cannot appear on a type member.TS1090'…' modifier cannot appear on a parameter.TS1097'…' list cannot be empty.TS1100Invalid use of '…' in strict mode.TS1101'with' statements are not allowed in strict mode.TS1102'delete' cannot be called on an identifier in strict mode.TS1109Expression expected.TS1110Type expected.TS1114Duplicate label '…'.TS1117An object literal cannot have multiple properties with the same name.TS1118An object literal cannot have multiple get/set accessors with the same name.TS1119An object literal cannot have property and accessor with the same name.TS1121Octal literals are not allowed. Use the syntax '…'.TS1124Digit expected.TS1125Hexadecimal digit expected.TS1127Invalid character.TS1128Declaration or statement expected.TS1131Property or signature expected.TS1134Variable declaration expected.TS1135Argument expression expected.TS1136Property assignment expected.TS1138Parameter declaration expected.TS1141String literal expected.TS1146Declaration expected.TS1160Unterminated template literal.TS1162An object member cannot be declared optional.TS1163A 'yield' expression is only allowed in a generator body.TS1181Array element destructuring pattern expected.TS1184Modifiers cannot appear here.TS1192Module '…' has no default export.TS1196Catch clause variable type annotation must be 'any' or 'unknown' if specified.TS1199Unterminated Unicode escape sequence.TS1200Line terminator not permitted before arrow.TS1206Decorators are not valid here.TS1210Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '…'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode.TS1212Identifier expected. '…' is a reserved word in strict mode.TS1213Identifier expected. '…' is a reserved word in strict mode. Class definitions are automatically in strict mode.TS1214Identifier expected. '…' is a reserved word in strict mode. Modules are automatically in strict mode.TS1215Invalid use of '…'. Modules are automatically in strict mode.TS1243'…' modifier cannot be used with '…' modifier.TS1244Abstract methods can only appear within an abstract class.TS1249A decorator can only decorate a method implementation, not an overload.TS1253Abstract properties can only appear within an abstract class.TS1344A label is not allowed here.TS1345An expression of type 'void' cannot be tested for truthiness.TS1351An identifier or keyword cannot immediately follow a numeric literal.TS1359Identifier expected. '…' is a reserved word that cannot be used here.TS1360Type '…' does not satisfy the expected type '…'.TS1381Unexpected token. Did you mean `{'}'}` or `}`?TS1382Unexpected token. Did you mean `{'>'}` or `>`?TS1433Neither decorators nor modifiers may be applied to 'this' parameters.TS1477An instantiation expression cannot be followed by a property access.TS1489Decimals with leading zeros are not allowed.TS1497Expression must be enclosed in parentheses to be used as a decorator.TS1499Unknown regular expression flag.TS1500Duplicate regular expression flag.TS1502The Unicode (u) flag and the Unicode Sets (v) flag cannot be set simultaneously.TS2300Duplicate identifier '…'.TS2304Cannot find name '…'.TS2305Module '…' has no exported member '…'.TS2307Cannot find module '…' or its corresponding type declarations.TS2314Generic type '…' requires … type argument(s).TS2315Type '…' is not generic.TS2320Interface '…' cannot simultaneously extend types '…' and '…'.TS2322Type '…' is not assignable to type '…'.TS2339Property '…' does not exist on type '…'.TS2341Property '…' is private and only accessible within class '…'.TS2344Type '…' does not satisfy the constraint '…'.TS2345Argument of type '…' is not assignable to parameter of type '…'.TS2348Value of type '…' is not callable. Did you mean to include 'new'?TS2349This expression is not callable.TS2351This expression is not constructable.TS2352Conversion of type '…' to type '…' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.TS2353Object literal may only specify known properties, and '…' does not exist in type '…'.TS2355A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.TS2356An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.TS2357The operand of an increment or decrement operator must be a variable or a property access.TS2358The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.TS2359The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method.TS2362The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.TS2363The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.TS2365Operator '…' cannot be applied to types '…' and '…'.TS2366Function lacks ending return statement and return type does not include 'undefined'.TS2367This comparison appears to be unintentional because the types '…' and '…' have no overlap.TS2369A parameter property is only allowed in a constructor implementation.TS2383Overload signatures must all be exported or non-exported.TS2384Overload signatures must all be ambient or non-ambient.TS2385Overload signatures must all be public, private or protected.TS2386Overload signatures must all be optional or required.TS2387Function overload must be static.TS2388Function overload must not be static.TS2389Function implementation name must be '…'.TS2390Constructor implementation is missing.TS2391Function implementation is missing or not immediately following the declaration.TS2392Multiple constructor implementations are not allowed.TS2393Duplicate function implementation.TS2394This overload signature is not compatible with its implementation signature.TS2403Subsequent variable declarations must have the same type. Variable '…' must be of type '…', but here has type '…'.TS2407The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '…'.TS2411Property '…' of type '…' is not assignable to '…' index type '…'.TS2413'…' index type '…' is not assignable to '…' index type '…'.TS2415Class '…' incorrectly extends base class '…'.TS2416Property '…' in type '…' is not assignable to the same property in base type '…'.TS2417Class static side '…' incorrectly extends base class static side '…'.TS2420Class '…' incorrectly implements interface '…'.TS2430Interface '…' incorrectly extends interface '…'.TS2435Ambient modules cannot be nested in other modules or namespaces.TS2445Property '…' is protected and only accessible within class '…' and its subclasses.TS2447The '…' operator is not allowed for boolean types. Consider using '…' instead.TS2448Block-scoped variable '…' used before its declaration.TS2449Class '…' used before its declaration.TS2450Enum '…' used before its declaration.TS2451Cannot redeclare block-scoped variable '…'.TS2454Variable '…' is used before being assigned.TS2464A computed property name must be of type 'string', 'number', 'symbol', or 'any'.TS2469The '…' operator cannot be applied to type 'symbol'.TS2488Type '…' must have a '[Symbol.iterator]()' method that returns an iterator.TS2493Tuple type '…' of length '…' has no element at index '…'.TS2503Cannot find namespace '…'.TS2511Cannot create an instance of an abstract class.TS2512Overload signatures must all be abstract or non-abstract.TS2515Non-abstract class '…' does not implement inherited abstract member … from class '…'.TS2528A module cannot have multiple default exports.TS2531Object is possibly 'null'.TS2532Object is possibly 'undefined'.TS2534A function returning 'never' cannot have a reachable end point.TS2538Type '…' cannot be used as an index type.TS2540Cannot assign to '…' because it is a read-only property.TS2542Index signature in type '…' only permits reading.TS2551Property '…' does not exist on type '…'. Did you mean '…'?TS2552Cannot find name '…'. Did you mean '…'?TS2554Expected … arguments, but got ….TS2555Expected at least … arguments, but got ….TS2556A spread argument must either have a tuple type or be passed to a rest parameter.TS2558Expected … type arguments, but got ….TS2559Type '…' has no properties in common with type '…'.TS2561Object literal may only specify known properties, but '…' does not exist in type '…'. Did you mean to write '…'?TS2564Property '…' has no initializer and is not definitely assigned in the constructor.TS2567Enum declarations can only merge with namespace or other enum declarations.TS2575No overload expects … arguments, but overloads do exist that expect either … or … arguments.TS2576Property '…' does not exist on type '…'. Did you mean to access the static member '…' instead?TS2578Unused '@ts-expect-error' directive.TS2584Cannot find name '…'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.TS2588Cannot assign to '…' because it is a constant.TS2589Type instantiation is excessively deep and possibly infinite.TS2591Cannot find name '…'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.TS2592Cannot find name '…'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig.TS2593Cannot find name '…'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig.TS2610'…' is defined as an accessor in class '…', but is overridden here in '…' as an instance property.TS2611'…' is defined as a property in class '…', but is overridden here in '…' as an accessor.TS2628Cannot assign to '…' because it is an enum.TS2629Cannot assign to '…' because it is a class.TS2630Cannot assign to '…' because it is a function.TS2631Cannot assign to '…' because it is a namespace.TS2654Non-abstract class '…' is missing implementations for the following members of '…': ….TS2664Invalid module name in augmentation, module '…' cannot be found.TS2669Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.TS2678Type '…' is not comparable to type '…'.TS2683'this' implicitly has type 'any' because it does not have a type annotation.TS2688Cannot find type definition file for '…'.TS2693'…' only refers to a type, but is being used as a value here.TS2694Namespace '…' has no exported member '…'.TS2703The operand of a 'delete' operator must be a property reference.TS2707Generic type '…' requires between … and … type arguments.TS2708Cannot use namespace '…' as a value.TS2717Subsequent property declarations must have the same type. Property '…' must be of type '…', but here has type '…'.TS2720Class '…' incorrectly implements class '…'. Did you mean to extend '…' and inherit its members as a subclass?TS2722Cannot invoke an object which is possibly 'undefined'.TS2729Property '…' is used before its initialization.TS2739Type '…' is missing the following properties from type '…': …TS2740Type '…' is missing the following properties from type '…': …, and … more.TS2741Property '…' is missing in type '…' but required in type '…'.TS2749'…' refers to a value, but is being used as a type here. Did you mean 'typeof …'?TS2769No overload matches this call.TS2790The operand of a 'delete' operator must be optional.TS2882Cannot find module or type declarations for side-effect import of '…'.TS4104The type '…' is 'readonly' and cannot be assigned to the mutable type '…'.TS4112This member cannot have an 'override' modifier because its containing class '…' does not extend another class.TS4113This member cannot have an 'override' modifier because it is not declared in the base class '…'.TS4114This member must have an 'override' modifier because it overrides a member in the base class '…'.TS4115This parameter property must have an 'override' modifier because it overrides a member in base class '…'.TS4127This member cannot have an 'override' modifier because its name is dynamic.TS5052Option '…' cannot be specified without specifying option '…'.TS5053Option '…' cannot be specified with option '…'.TS5055Cannot write file '…' because it would overwrite input file.TS5061Pattern '…' can have at most one '*' character.TS5062Substitution '…' in pattern '…' can have at most one '*' character.TS5069Option '…' cannot be specified without specifying option '…' or option '…'.TS5076'…' and '…' operations cannot be mixed without parentheses.TS5090Non-relative paths are not allowed. Did you forget a leading './'?TS5095Option '…' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later.TS5102Option '…' has been removed. Please remove it from your configuration.TS5110Option 'module' must be set to '…' when option 'moduleResolution' is set to '…'.TS6053File '…' not found.TS6133'…' is declared but its value is never read.TS6142Module '…' was resolved to '…', but '--jsx' is not set.TS6188Numeric separators are not allowed here.TS6189Multiple consecutive numeric separators are not permitted.TS6196'…' is declared but never used.TS7006Parameter '…' implicitly has an '…' type.TS7009'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.TS7010'…', which lacks return-type annotation, implicitly has an '…' return type.TS7013Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.TS7015Element implicitly has an 'any' type because index expression is not of type 'number'.TS7016Could not find a declaration file for module '…'. '…' implicitly has an 'any' type.TS7026JSX element implicitly has type 'any' because no interface 'JSX.…' exists.TS7027Unreachable code detected.TS7028Unused label.TS7032Property '…' implicitly has type 'any', because its set accessor lacks a parameter type annotation.TS7053Element implicitly has an 'any' type because expression of type '…' can't be used to index type '…'.TS17002Expected corresponding JSX closing tag for '…'.TS17004Cannot use JSX unless the '--jsx' flag is provided.TS17006An unary expression with the '…' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.TS17007A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.TS17008JSX element '…' has no corresponding closing tag.TS18013Property '…' is not accessible outside class '…' because it has a private identifier.TS18046'…' is of type 'unknown'.TS18047'…' is possibly 'null'.TS18048'…' is possibly 'undefined'.TS18049'…' is possibly 'null' or 'undefined'.TS18050The value '…' cannot be used here.
TypeScript syntax in JavaScript files (TS8xxx)
ts-r’s parser reports these like tsc when it reads .js files with tsc’s rules for TypeScript syntax. ts-r-check does not report them yet.
TS8002'import ... =' can only be used in TypeScript files.TS8003'export =' can only be used in TypeScript files.TS8004Type parameter declarations can only be used in TypeScript files.TS8005'implements' clauses can only be used in TypeScript files.TS8006'…' declarations can only be used in TypeScript files.TS8008Type aliases can only be used in TypeScript files.TS8009The '…' modifier can only be used in TypeScript files.TS8010Type annotations can only be used in TypeScript files.TS8011Type arguments can only be used in TypeScript files.TS8012Parameter modifiers can only be used in TypeScript files.TS8013Non-null assertions can only be used in TypeScript files.TS8016Type assertion expressions can only be used in TypeScript files.TS8017Signature declarations can only be used in TypeScript files.TS8037Type satisfaction expressions can only be used in TypeScript files.
ts-r’s own codes (TS99xxx)
Limits that keep ts-r from crashing on pathological input. tsc has no equivalent.
TS99001Maximum nesting depth exceeded; the rest of this construct was skipped.TS99002File is too large to parse (over 4 GiB).TS99003The parser stopped making progress; the rest of this file was skipped.
Sound-mode codes (TSR)
Diagnostics from sound mode (design record 0007, Accepted), reported only in files that opt in. Their examples are the record’s spec cases, not runs.
TSR0001'@ts-r-unsafe' needs a reason: write '// @ts-r-unsafe: <why this is safe>'.TSR0002Unused '@ts-r-unsafe' directive: the next line has no sound-mode error.TSR0003Unknown sound-mode rule '…' in '@ts-r-unsafe'. Rules are S-01 to S-14.TSR0004Unknown level '…' in '@ts-r' pragma. Use 'off', 'strict', 'sound' or 'contracts'.TSR0005The '@ts-r' pragma must come before the first statement; this one is ignored.TSR0010… (sound mode enables 'isolatedDeclarations').TSR0011… (sound mode enables '…').TSR0020Invalid sound-mode configuration: ….TSR0101Type 'any' is not allowed in sound mode. Use 'unknown', a type parameter or a specific type.TSR0102'…' is 'unknown' in sound mode because '…' declares it as 'any'. Narrow it or parse it with 'parse<T>'.TSR0103Calling a value of type 'Function' returns 'any'. Give '…' a function type.TSR0201Type assertion from '…' to '…' narrows the type. Use 'parse<…>', 'is<…>' or a narrowing check instead.TSR0301Non-null assertion is not allowed in sound mode. Narrow '…' with a check, or use 'expect(…, "why")'.TSR0401… (sound mode enables 'noUncheckedIndexedAccess': indexed reads can be 'undefined').TSR0402… (sound mode enables 'exactOptionalPropertyTypes': write '…?: T | undefined' to allow 'undefined').TSR0501'…' is not assignable to '…': mutable '…' is invariant in sound mode, so writes through '…' could break '…'. Use '…' if it is only read.TSR0601Method '…' is not compatible: parameter '…' of type '…' would receive '…'. Methods are checked like functions in sound mode.TSR0701Type predicate '… is …' is not proved: when it returns true, '…' can be '…'.TSR0702Type predicate '… is …' is not proved: when it returns false, '…' can still be '…'.TSR0703Assertion '…' is not proved: the function can return normally with '…' of type '…'.TSR0801Definite assignment assertion on '…' is not allowed in sound mode. Initialise it in its declaration or the constructor.TSR0802'this' escapes before '…' is initialised. Assign every field first.TSR0803'this' escapes from the constructor through '…' before subclass fields are initialised. Make it '#private', or do this after construction (a static factory).TSR0901'…' may have changed since it was narrowed: '…' on line … can modify it. Copy it to a 'const' before that point.TSR0902'…' may have changed since it was narrowed: it is assigned in a closure, and '…' on line … can run that closure.TSR1001Promise from '…' is not handled. Await it, return it, or attach '.catch'.TSR1002'void' discards a promise that can reject. Attach '.catch' first: 'void ….catch(...)'.TSR1003Async function passed where '…' expects a function returning 'void'; its promise is never handled.TSR1101Augmenting module '…' in a sound file changes its trusted types without a check. Move the augmentation to a '.d.ts' file.TSR1102Shorthand ambient module '…' makes every import 'any'. Declare its types in a '.d.ts' file.TSR1103Ambient declaration '…' in a sound file asserts a value exists without checking it. Move it to a '.d.ts' file or import the real value.TSR1201'@…' is not allowed in sound mode. Fix the error, or use '// @ts-r-unsafe: <reason>' for sound-mode errors.TSR1202'@ts-nocheck' cannot be used in a sound file. Set the file to '// @ts-r off' instead.TSR1204Global augmentation in a sound file changes types for the whole program without a check. Move it to a '.d.ts' file.TSR1205Overload '…' is not satisfied by its implementation: called through it, the body can return '…', which is not assignable to '…'.TSR1301'…' can throw '…', which is not in its '@throws' tags. Catch it or add a '@throws' tag for it.TSR1302Exported '…' can throw '…' but has no '@throws' tag. Document it with a '@throws' tag.TSR1303Only Error objects can be thrown in sound mode; '…' is not assignable to 'Error'.TSR1304'…' can throw '…', which '…' (the member it overrides or implements) does not declare.TSR1401Value from external source '…' must be parsed before use: write 'parse<T>(…)' with the type you expect.TSR1402'…' needs an explicit type argument in sound mode, e.g. '…<User>(...)'.TSR1501Type '…' cannot be checked at runtime: ….TSR1502'…<…>' needs a concrete type, but '…' is a type parameter. Take a 'Guard<…>' argument and call 'guard<User>()' at the call site.TSR1503'…' from '@ts-r.dev/guard' must be called with a type argument; it can't be used as a value.TSR1504The validator for '…' is … KB, over the … KB budget. Validate a smaller type or raise '[sound.guard] max-validator-kb'.