Every TypeScript error code explained with real examples and fixes. Search by error code or message to find exactly what you need.
A TypeScript error message has two parts: the code (like TS2345) tells you the category of problem, and the message tells you which types are involved. The reference covers the errors you will actually hit day to day — assignability problems, null and undefined checks, missing properties, and implicit any. Each page explains what the compiler is complaining about, shows the mistake in real code, and walks through the idiomatic fix. When you are done fixing, the best way to stop hitting the same error again is to practice with TypeScript challenges built around it.
59 of 59 errors
Unterminated string literal
Identifier expected
'x' expected
An element access expression should take an argument
Invalid use of 'X' in strict mode
Expression expected
Declaration or statement expected
Property assignment expected
Unterminated template literal
Module 'X' has no default export
Decorators are not valid here
Duplicate identifier 'X'
Cannot find name 'X'
Module 'X' has no exported member 'Y'
Cannot find module 'X' or its corresponding type declarations
Generic type 'X' requires N type argument(s)
Type 'X' is not assignable to type 'Y'
Property 'X' does not exist on type 'Y'
Type 'X' does not satisfy the constraint 'Y'
Argument of type 'X' is not assignable to parameter of type 'Y'
This expression is not callable
Conversion of type 'X' to type 'Y' may be a mistake
Subsequent variable declarations must have the same type. Variable 'X' must be of type 'Y', but here...
Property 'X' in type 'Y' is not assignable to the same property in base type 'Z'
Cannot redeclare block-scoped variable 'X'
Variable 'X' is used before being assigned
Cannot find namespace 'X'
Object is possibly 'null'
Object is possibly 'undefined'
Property 'X' does not exist on type 'Y'. Did you mean 'Z'?
Expected N arguments, but got M
A spread argument must either have a tuple type or be passed to a rest parameter
Property 'x' has no initializer and is not definitely assigned in the constructor
Object is of type 'unknown'
'this' implicitly has type 'any' because it does not have a type annotation
Cannot find type definition file for 'X'
'X' only refers to a type, but is being used as a value here
Namespace 'X' has no exported member 'Y'
Type 'X' is missing the following properties from type 'Y'
The inferred type of 'X' cannot be named without a reference to 'Y'. This is likely not portable. A ...
No overload matches this call
'X' cannot be used as a JSX component
Option 'X' cannot be specified with option 'Y'
Cannot write file 'X' because it would overwrite input file
File 'X' is not under 'rootDir' 'Y'. 'rootDir' is expected to contain all source files
'X' is declared but its value is never read
Output file 'X' has not been built from source file 'Y'
File 'X' is not listed within the file list of project 'Y'. Projects must list all files or use an '...
'X' is deprecated
Parameter 'x' implicitly has an 'any' type
Could not find a declaration file for module 'X'. 'Y' implicitly has an 'any' type
'x' implicitly has type 'any' because it does not have a type annotation and is referenced directly ...
Fallthrough case in switch
Not all code paths return a value
Element implicitly has an 'any' type because expression of type 'X' can't be used to index type 'Y'
Type annotations can only be used in TypeScript files
'x' is of type 'unknown'
'x' is possibly 'null'
'x' is possibly 'undefined'