Issue
In Typescript, where do I find a complete reference of all error codes and their fixes.
My usecase is that I often see errors when compiling. for example:
data_loader_service.ts(10,13): error TS1005: '=>' expected.
data_loader_service.ts(10,24): error TS1144: '{' or ';' expected.
data_loader_service.ts(10,27): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
data_loader_service.ts(14,1): error TS1128: Declaration or statement expected.
I am looking for a place where I can easily lookup the error codes, e.g. TS1068 and read about the typical error and the typical fixes.
I am inspired by, for instance Jscs, which give nice overviews of all potential error codes.
Example from Jscs: http://jscs.info/rules
I am accepting responses that refer to either sourcecode or a finer webpage like the jscs example.
I expect you post an answer regarding the new Typescript (currently 1.6 is the most recent).
Solution
Looking at the 1.6.2 sources of the compiler, tsc.js
, tsserver.js
, typescript.js
and typescriptServices.js
, a variable called ts.Diagnostics
is initialized with a dictionary of all the error codes.
List of codes and definitions of 1.6.2 (unfortunately ugly formatted): https://github.com/Microsoft/TypeScript/blob/v1.6.2/src/compiler/diagnosticInformationMap.generated.ts
A slightly prettier format is available: https://github.com/Microsoft/TypeScript/blob/v1.6.2/src/compiler/diagnosticMessages.json
EDIT
Link to 1.8.5 errors: https://github.com/Microsoft/TypeScript/blob/v1.8.5/src/compiler/diagnosticMessages.json
Answered By - Bruno Grieder
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.