If you're looking for the list of diagnostic messages, you can check out src/compiler/diagnosticMessages.json
in the TypeScript repository. The file is organized in this format:
{
"Unterminated string literal.": {
"category": "Error",
"code": 1002
},
"Identifier expected.": {
"category": "Error",
"code": 1003
},
"'{0}' expected.": {
"category": "Error",
"code": 1005
},
"A file cannot have a reference to itself.": {
"category": "Error",
"code": 1006
},
// and so on...
}
But unfortunately, there doesn't seem to be a comprehensive list with explanations available.
When you encounter TS9005 (
Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.
), it indicates that a JavaScript file is exporting an item with a non-exported type. For instance:
foo.d.ts
interface Foo {
foo: number
}
declare function foo(): Foo
export = foo
bar.js
// @ts-check
module.exports = require('./foo')()
The issue here is that TypeScript cannot generate a declaration file for bar.js
because the export relies on the type Foo
, which isn't exported from foo.d.ts
. You can address this by specifying the type for the export:
bar.js
// @ts-check
/** @type {{foo: number}} */
module.exports = require('./foo')()