TypeScript Errors Reference

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.

34 of 34 errors

TS1002

Fix TS1002: Unterminated String Literal

Unterminated string literal

Syntax ErrorSyntaxStringsParsing
TS1003

Fix TS1003: Identifier Expected

Identifier expected

Syntax ErrorSyntaxParsingImports
TS1005

Fix TS1005: Expected Token

'x' expected

Syntax ErrorSyntaxParsingPunctuation
TS1109

Fix TS1109: Expression Expected

Expression expected

Syntax ErrorSyntaxParsingJSX
TS2304

Fix TS2304: Cannot Find Name 'X'

Cannot find name 'X'

Semantic ErrorImportsDeclarationsScope
TS2305

Fix TS2305: Module Has No Exported Member

Module 'X' has no exported member 'Y'

Semantic ErrorModulesImportsType Safety
TS2307

Fix TS2307: Cannot Find Module

Cannot find module 'X' or its corresponding type declarations

Semantic ErrorModulesImportsConfig
TS2322

Fix TS2322: Type Not Assignable

Type 'X' is not assignable to type 'Y'

Semantic ErrorType SafetyAssignmentType Checking
TS2339

Fix TS2339: Property Does Not Exist on Type

Property 'X' does not exist on type 'Y'

Semantic ErrorProperty AccessType SafetyObjects
TS2345

Fix TS2345: Argument Type Not Assignable to Parameter

Argument of type 'X' is not assignable to parameter of type 'Y'

Semantic ErrorFunction ArgumentsType SafetyParameters
TS2349

Fix TS2349: This Expression Is Not Callable

This expression is not callable

Semantic ErrorType SafetyFunctionsUnion Types
TS2352

Fix TS2352: Type Conversion May Be a Mistake

Conversion of type 'X' to type 'Y' may be a mistake

Semantic ErrorType AssertionsType CastingType Safety
TS2451

Fix TS2451: Cannot Redeclare Block-Scoped Variable

Cannot redeclare block-scoped variable 'X'

Semantic ErrorModulesScopeConfig
TS2531

Fix TS2531: Object Is Possibly 'null'

Object is possibly 'null'

Strict ModeNull SafetyStrict ModeNull Checks
TS2532

Fix TS2532: Object Is Possibly 'undefined'

Object is possibly 'undefined'

Strict ModeNull SafetyStrict ModeOptional Chaining
TS2551

Fix TS2551: Property Does Not Exist - Did You Mean?

Property 'X' does not exist on type 'Y'. Did you mean 'Z'?

Semantic ErrorTyposProperty AccessSuggestions
TS2554

Fix TS2554: Wrong Number of Arguments

Expected N arguments, but got M

Semantic ErrorFunction ArgumentsArityParameters
TS2556

Fix TS2556: Spread Argument Must Have Tuple Type

A spread argument must either have a tuple type or be passed to a rest parameter

Semantic ErrorSpread OperatorTuplesRest Parameters
TS2564

Fix TS2564: Property Has No Initializer

Property 'x' has no initializer and is not definitely assigned in the constructor

Strict ModeStrict ModeClass PropertiesInitialization
TS2571

Fix TS2571: Object Is of Type 'unknown'

Object is of type 'unknown'

Semantic ErrorUnknown TypeType SafetyType Guards
TS2683

Fix TS2683: 'this' Implicitly Has Type 'any'

'this' implicitly has type 'any' because it does not have a type annotation

Strict Modethis ContextStrict ModenoImplicitThis
TS2740

Fix TS2740: Type 'X' Is Missing Properties from Type 'Y'

Type 'X' is missing the following properties from type 'Y'

Semantic ErrorObject TypesMissing PropertiesInterfaces
TS2769

Fix TS2769: No Overload Matches This Call

No overload matches this call

Semantic ErrorOverloadsFunction CallsType Safety
TS2786

Fix TS2786: Cannot Be Used as a JSX Component

'X' cannot be used as a JSX component

Semantic ErrorJSXReactType Safety
TS5055

Fix TS5055: Cannot Write File, Would Overwrite Input

Cannot write file 'X' because it would overwrite input file

Command ErrorConfigBuildModules
TS6133

Fix TS6133: Declared but Its Value Is Never Read

'X' is declared but its value is never read

SuggestionConfigCode QualityStrict Mode
TS6307

Fix TS6307: File Is Not Listed Within the Project File List

File 'X' is not listed within the file list of project 'Y'. Projects must list all files or use an '...

Command ErrorConfigBuildModules
TS7006

Fix TS7006: Parameter Implicitly Has 'any' Type

Parameter 'x' implicitly has an 'any' type

Strict ModeStrict ModeType AnnotationsnoImplicitAny
TS7016

Fix TS7016: Could Not Find a Declaration File for Module

Could not find a declaration file for module 'X'. 'Y' implicitly has an 'any' type

Strict ModeModulesStrict ModeDeclarations
TS7022

Fix TS7022: Implicitly Has Type 'any'

'x' implicitly has type 'any' because it does not have a type annotation and is referenced directly ...

Strict ModeCircular ReferencesType InferencenoImplicitAny
TS7029

Fix TS7029: Fallthrough Case in Switch

Fallthrough case in switch

Strict ModeCode QualityControl FlowConfig
TS7030

Fix TS7030: Not All Code Paths Return a Value

Not all code paths return a value

Strict ModeStrict ModeFunctionsControl Flow
TS7053

Fix TS7053: Expression Can't Be Used to Index Type

Element implicitly has an 'any' type because expression of type 'X' can't be used to index type 'Y'

Strict ModeStrict ModeIndex SignaturesType Safety
TS18046

Fix TS18046: 'x' Is of Type 'unknown'

'x' is of type 'unknown'

Semantic ErrorUnknown TypeType GuardsError Handling