一、概述
如果一个目录下存在一个tsconfig.json
文件,那么它意味着这个目录是TypeScript项目的根目录。 tsconfig.json
文件中指定了用来编译这个项目的根文件和编译选项。 一个项目可以通过以下方式之一来编译:
使用tsconfig.json
- 不带任何输入文件的情况下调用
tsc
,编译器会从当前目录开始去查找tsconfig.json
文件,逐级向上搜索父目录。 - 不带任何输入文件的情况下调用
tsc
,且使用命令行参数--project
(或-p
)指定一个包含tsconfig.json
文件的目录。
当命令行上指定了输入文件时,tsconfig.json
文件会被忽略。
示例
tsconfig.json
示例文件:
-
使用
"files"
属性{ "compilerOptions": { "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": true }, "files": [ "core.ts", "sys.ts", "types.ts", "scanner.ts", "parser.ts", "utilities.ts", "binder.ts", "checker.ts", "emitter.ts", "program.ts", "commandLineParser.ts", "tsc.ts", "diagnosticInformationMap.generated.ts" ] }
-
使用
"include"
和"exclude"
属性{ "compilerOptions": { "module": "system", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "outFile": "../../built/local/tsc.js", "sourceMap": true }, "include": [ "src/**/*" ], "exclude": [ "node_modules", "**/*.spec.ts" ] }
细节
"compilerOptions"
可以被忽略,这时编译器会使用默认值。在这里查看完整的编译器选项列表。
"files"
指定一个包含相对或绝对文件路径的列表。 "include"
和"exclude"
属性指定一个文件glob匹配模式列表。 支持的glob通配符有:
*
匹配0或多个字符(不包括目录分隔符)?
匹配一个任意字符(不包括目录分隔符)**/
递归匹配任意子目录
如果一个glob模式里的某部分只包含*
或.*
,那么仅有支持的文件扩展名类型被包含在内(比如默认.ts
,.tsx
,和.d.ts
, 如果 allowJs
设置能true
还包含.js
和.jsx
)。
如果"files"
和"include"
都没有被指定,编译器默认包含当前目录和子目录下所有的TypeScript文件(.ts
, .d.ts
和 .tsx
),排除在"exclude"
里指定的文件。JS文件(.js
和.jsx
)也被包含进来如果allowJs
被设置成true
。 如果指定了 "files"
或"include"
,编译器会将它们结合一并包含进来。 使用 "outDir"
指定的目录下的文件永远会被编译器排除,除非你明确地使用"files"
将其包含进来(这时就算用exclude
指定也没用)。
使用"include"
引入的文件可以使用"exclude"
属性过滤。 然而,通过 "files"
属性明确指定的文件却总是会被包含在内,不管"exclude"
如何设置。 如果没有特殊指定, "exclude"
默认情况下会排除node_modules
,bower_components
,jspm_packages
和<outDir>
目录。
任何被"files"
或"include"
指定的文件所引用的文件也会被包含进来。 A.ts
引用了B.ts
,因此B.ts
不能被排除,除非引用它的A.ts
在"exclude"
列表中。
需要注意编译器不会去引入那些可能做为输出的文件;比如,假设我们包含了index.ts
,那么index.d.ts
和index.js
会被排除在外。 通常来讲,不推荐只有扩展名的不同来区分同目录下的文件。
tsconfig.json
文件可以是个空文件,那么所有默认的文件(如上面所述)都会以默认配置选项编译。
在命令行上指定的编译选项会覆盖在tsconfig.json
文件里的相应选项。
@types
,typeRoots
和types
默认所有可见的"@types
"包会在编译过程中被包含进来。 node_modules/@types
文件夹下以及它们子文件夹下的所有包都是可见的; 也就是说, ./node_modules/@types/
,../node_modules/@types/
和../../node_modules/@types/
等等。
如果指定了typeRoots
,只有typeRoots
下面的包才会被包含进来。 比如:
{
"compilerOptions": {
"typeRoots" : ["./typings"]
}
}
这个配置文件会包含所有./typings
下面的包,而不包含./node_modules/@types
里面的包。
如果指定了types
,只有被列出来的包才会被包含进来。 比如:
{
"compilerOptions": {
"types" : ["node", "lodash", "express"]
}
}
这个tsconfig.json
文件将仅会包含 ./node_modules/@types/node
,./node_modules/@types/lodash
和./node_modules/@types/express
。/@types/。 node_modules/@types/*
里面的其它包不会被引入进来。
指定"types": []
来禁用自动引入@types
包。
注意,自动引入只在你使用了全局的声明(相反于模块)时是重要的。 如果你使用 import "foo"
语句,TypeScript仍然会查找node_modules
和node_modules/@types
文件夹来获取foo
包。
使用extends
继承配置
tsconfig.json
文件可以利用extends
属性从另一个配置文件里继承配置。
extends
是tsconfig.json
文件里的顶级属性(与compilerOptions
,files
,include
,和exclude
一样)。 extends
的值是一个字符串,包含指向另一个要继承文件的路径。
在原文件里的配置先被加载,然后被来至继承文件里的配置重写。 如果发现循环引用,则会报错。
来至所继承配置文件的files
,include
和exclude
覆盖源配置文件的属性。
配置文件里的相对路径在解析时相对于它所在的文件。
比如:
configs/base.json
:
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true
}
}
tsconfig.json
:
{
"extends": "./configs/base",
"files": [
"main.ts",
"supplemental.ts"
]
}
tsconfig.nostrictnull.json
:
{
"extends": "./tsconfig",
"compilerOptions": {
"strictNullChecks": false
}
}
compileOnSave
在最顶层设置compileOnSave
标记,可以让IDE在保存文件的时候根据tsconfig.json
重新生成文件。
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny" : true
}
}
要想支持这个特性需要Visual Studio 2015, TypeScript1.8.4以上并且安装atom-typescript插件。
模式
到这里查看模式: http://json.schemastore.org/tsconfig.
二、错误信息列表
code | 类型 | 英文描述 | 中文描述 |
---|---|---|---|
1002 | 错误 | Unterminated string literal. | 未终止的字符串文本。 |
1003 | 错误 | Identifier expected. | 应为标识符。 |
1005 | 错误 | '{0}' expected. | 应为“{0}”。 |
1006 | 错误 | A file cannot have a reference to itself. | 文件不能引用自身。 |
1009 | 错误 | Trailing comma not allowed. | 不允许使用尾随逗号。 |
1010 | 错误 | '*/' expected. | 应为 "*/"。 |
1012 | 错误 | Unexpected token. | 意外的标记。 |
1014 | 错误 | A rest parameter must be last in a parameter list. | rest 参数必须是参数列表中的最后一个参数。 |
1015 | 错误 | Parameter cannot have question mark and initializer. | 参数不能包含问号和初始化表达式。 |
1016 | 错误 | A required parameter cannot follow an optional parameter. | 必选参数不能位于可选参数后。 |
1017 | 错误 | An index signature cannot have a rest parameter. | 索引签名不能包含 rest 参数。 |
1018 | 错误 | An index signature parameter cannot have an accessibility modifier. | 索引签名参数不能具有可访问性修饰符。 |
1019 | 错误 | An index signature parameter cannot have a question mark. | 索引签名参数不能包含问号。 |
1020 | 错误 | An index signature parameter cannot have an initializer. | 索引签名参数不能具有初始化表达式。 |
1021 | 错误 | An index signature must have a type annotation. | 索引签名必须具有类型批注。 |
1022 | 错误 | An index signature parameter must have a type annotation. | 索引签名参数必须具有类型批注。 |
1023 | 错误 | An index signature parameter type must be 'string' or 'number'. | 索引签名参数类型必须为 "string" 或 "number"。 |
1024 | 错误 | 'readonly' modifier can only appear on a property declaration or index signature. | |
1028 | 错误 | Accessibility modifier already seen. | 已看到可访问性修饰符。 |
1029 | 错误 | '{0}' modifier must precede '{1}' modifier. | “{0}”修饰符必须位于“{1}”修饰符之前。 |
1030 | 错误 | '{0}' modifier already seen. | 已看到“{0}”修饰符。 |
1031 | 错误 | '{0}' modifier cannot appear on a class element. | “{0}”修饰符不能出现在类元素上。 |
1034 | 错误 | 'super' must be followed by an argument list or member access. | "super" 的后面必须是参数列表或成员访问。 |
1035 | 错误 | Only ambient modules can use quoted names. | 仅环境模块可使用带引号的名称。 |
1036 | 错误 | Statements are not allowed in ambient contexts. | 不允许在环境上下文中使用语句。 |
1038 | 错误 | A 'declare' modifier cannot be used in an already ambient context. | 不能在已有的环境上下文中使用 "declare" 修饰符。 |
1039 | 错误 | Initializers are not allowed in ambient contexts. | 不允许在环境上下文中使用初始化表达式。 |
1040 | 错误 | '{0}' modifier cannot be used in an ambient context. | “{0}”修饰符不能在环境上下文中使用。 |
1041 | 错误 | '{0}' modifier cannot be used with a class declaration. | “{0}”修饰符不能与类声明一起使用。 |
1042 | 错误 | '{0}' modifier cannot be used here. | “{0}”修饰符不能在此处使用。 |
1043 | 错误 | '{0}' modifier cannot appear on a data property. | “{0}”修饰符不能出现在数据属性上。 |
1044 | 错误 | '{0}' modifier cannot appear on a module or namespace element. | “{0}”修饰符不能出现在模块元素上。 |
1045 | 错误 | A '{0}' modifier cannot be used with an interface declaration. | “{0}”修饰符不能与接口声明一起使用。 |
1046 | 错误 | A 'declare' modifier is required for a top level declaration in a .d.ts file. | 在 .d.ts 文件中的顶层声明需要 "declare" 修饰符。 |
1047 | 错误 | A rest parameter cannot be optional. | rest 参数不能为可选参数。 |
1048 | 错误 | A rest parameter cannot have an initializer. | rest 参数不能具有初始化表达式。 |
1049 | 错误 | A 'set' accessor must have exactly one parameter. | "set" 访问器必须正好具有一个参数。 |
1051 | 错误 | A 'set' accessor cannot have an optional parameter. | "set" 访问器不能具有可选参数。 |
1052 | 错误 | A 'set' accessor parameter cannot have an initializer. | "set" 访问器参数不能包含初始化表达式。 |
1053 | 错误 | A 'set' accessor cannot have rest parameter. | "set" 访问器不能具有 rest 参数。 |
1054 | 错误 | A 'get' accessor cannot have parameters. | "get" 访问器不能具有参数。 |
1055 | 错误 | Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. | 类型“{0}”不是有效的异步函数返回类型。 |
1056 | 错误 | Accessors are only available when targeting ECMAScript 5 and higher. | 访问器仅在面向 ECMAScript 5 和更高版本时可用。 |
1057 | 错误 | An async function or method must have a valid awaitable return type. | 异步函数或方法必须具有有效的可等待返回类型。 |
1058 | 错误 | Operand for 'await' does not have a valid callable 'then' member. | "await" 的操作数不具有有效的可调用 "then" 成员。 |
1059 | 错误 | Return expression in async function does not have a valid callable 'then' member. | 异步函数中的返回表达式不具有有效的可调用 "then" 成员。 |
1060 | 错误 | Expression body for async arrow function does not have a valid callable 'then' member. | 异步箭头函数的表达式主体不具有有效的可调用 "then" 成员。 |
1061 | 错误 | Enum member must have initializer. | 枚举成员必须具有初始化表达式。 |
1062 | 错误 | {0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method. | {0} 在其自身的 "then" 方法的 fulfillment 回调中得到直接或间接引用。 |
1063 | 错误 | An export assignment cannot be used in a namespace. | 不能在命名空间中使用导出分配。 |
1064 | 错误 | The return type of an async function or method must be the global Promise type. | The return type of an async function or method must be the global Promise type. |
1066 | 错误 | In ambient enum declarations member initializer must be constant expression. | 在环境枚举声明中,成员初始化表达式必须是常数表达式。 |
1068 | 错误 | Unexpected token. A constructor, method, accessor, or property was expected. | 意外的标记。应为构造函数、方法、访问器或属性。 |
1070 | 错误 | '{0}' modifier cannot appear on a type member. | |
1071 | 错误 | '{0}' modifier cannot appear on an index signature. | |
1079 | 错误 | A '{0}' modifier cannot be used with an import declaration. | “{0}”修饰符不能与导入声明一起使用。 |
1084 | 错误 | Invalid 'reference' directive syntax. | "reference" 指令语法无效。 |
1085 | 错误 | Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'. | 面向 ECMAScript 5 和更高版本时,八进制文本不可用。 |
1086 | 错误 | An accessor cannot be declared in an ambient context. | 不能在环境上下文中声明访问器。 |
1089 | 错误 | '{0}' modifier cannot appear on a constructor declaration. | “{0}”修饰符不能出现在构造函数声明中。 |
1090 | 错误 | '{0}' modifier cannot appear on a parameter. | “{0}”修饰符不能出现在参数中。 |
1091 | 错误 | Only a single variable declaration is allowed in a 'for...in' statement. | "for...in" 语句中只允许单个变量声明。 |
1092 | 错误 | Type parameters cannot appear on a constructor declaration. | 类型参数不能出现在构造函数声明中。 |
1093 | 错误 | Type annotation cannot appear on a constructor declaration. | 类型批注不能出现在构造函数声明中。 |
1094 | 错误 | An accessor cannot have type parameters. | 访问器不能具有类型参数。 |
1095 | 错误 | A 'set' accessor cannot have a return type annotation. | "set" 访问器不能具有返回类型批注。 |
1096 | 错误 | An index signature must have exactly one parameter. | 索引签名必须正好具有一个参数。 |
1097 | 错误 | '{0}' list cannot be empty. | “{0}”列表不能为空。 |
1098 | 错误 | Type parameter list cannot be empty. | 类型参数列表不能为空。 |
1099 | 错误 | Type argument list cannot be empty. | 类型参数列表不能为空。 |
1100 | 错误 | Invalid use of '{0}' in strict mode. | 严格模式下“{0}”的使用无效。 |
1101 | 错误 | 'with' statements are not allowed in strict mode. | 严格模式下不允许使用 "with" 语句。 |
1102 | 错误 | 'delete' cannot be called on an identifier in strict mode. | 在严格模式下,无法对标识符调用 "delete"。 |
1104 | 错误 | A 'continue' statement can only be used within an enclosing iteration statement. | "continue" 语句只能在封闭迭代语句内使用。 |
1105 | 错误 | A 'break' statement can only be used within an enclosing iteration or switch statement. | "break" 语句只能在封闭迭代或 switch 语句内使用。 |
1107 | 错误 | Jump target cannot cross function boundary. | 跳转目标不能跨越函数边界。 |
1108 | 错误 | A 'return' statement can only be used within a function body. | "return" 语句只能在函数体中使用。 |
1109 | 错误 | Expression expected. | 应为表达式。 |
1110 | 错误 | Type expected. | 应为类型。 |
1113 | 错误 | A 'default' clause cannot appear more than once in a 'switch' statement. | "default" 子句在 "switch" 语句中只能出现一次。 |
1114 | 错误 | Duplicate label '{0}' | 标签“{0}”重复 |
1115 | 错误 | A 'continue' statement can only jump to a label of an enclosing iteration statement. | "continue" 语句只能跳转到封闭迭代语句的标签。 |
1116 | 错误 | A 'break' statement can only jump to a label of an enclosing statement. | "break" 语句只能跳转到封闭语句的标签。 |
1117 | 错误 | An object literal cannot have multiple properties with the same name in strict mode. | 严格模式下,对象文字不能包含多个具有相同名称的属性。 |
1118 | 错误 | An object literal cannot have multiple get/set accessors with the same name. | 对象文字不能具有多个具有相同名称的 get/set 访问器。 |
1119 | 错误 | An object literal cannot have property and accessor with the same name. | 对象文字不能包含具有相同名称的属性和访问器。 |
1120 | 错误 | An export assignment cannot have modifiers. | 导出分配不能具有修饰符。 |
1121 | 错误 | Octal literals are not allowed in strict mode. | 严格模式下不允许使用八进制文本。 |
1122 | 错误 | A tuple type element list cannot be empty. | 元组类型元素列表不能为空。 |
1123 | 错误 | Variable declaration list cannot be empty. | 变量声明列表不能为空。 |
1124 | 错误 | Digit expected. | 应为数字。 |
1125 | 错误 | Hexadecimal digit expected. | 应为十六进制数字。 |
1126 | 错误 | Unexpected end of text. | 文本意外结束。 |
1127 | 错误 | Invalid character. | 无效的字符。 |
1128 | 错误 | Declaration or statement expected. | 应为声明或语句。 |
1129 | 错误 | Statement expected. | 应为语句。 |
1130 | 错误 | 'case' or 'default' expected. | 应为 "case" 或 "default"。 |
1131 | 错误 | Property or signature expected. | 应为属性或签名。 |
1132 | 错误 | Enum member expected. | 应为枚举成员。 |
1134 | 错误 | Variable declaration expected. | 应为变量声明。 |
1135 | 错误 | Argument expression expected. | 应为参数表达式。 |
1136 | 错误 | Property assignment expected. | 应为属性分配。 |
1137 | 错误 | Expression or comma expected. | 应为表达式或逗号。 |
1138 | 错误 | Parameter declaration expected. | 应为参数声明。 |
1139 | 错误 | Type parameter declaration expected. | 应为类型参数声明。 |
1140 | 错误 | Type argument expected. | 应为类型参数。 |
1141 | 错误 | String literal expected. | 应为字符串文本。 |
1142 | 错误 | Line break not permitted here. | 不允许在此处换行。 |
1144 | 错误 | '{' or ';' expected. | 应为 "{" 或 ";"。 |
1146 | 错误 | Declaration expected. | 应为声明。 |
1147 | 错误 | Import declarations in a namespace cannot reference a module. | 命名空间中的导入声明不能引用模块。 |
1148 | 错误 | Cannot use imports, exports, or module augmentations when '--module' is 'none'. | Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file. |
1149 | 错误 | File name '{0}' differs from already included file name '{1}' only in casing | 文件名“{0}”仅在大小写方面与包含的文件名“{1}”不同 |
1150 | 错误 | 'new T[]' cannot be used to create an array. Use 'new Array ()' instead. | "new T[]" 不能用于创建数组。请改用 "new Array ()"。 |
1155 | 错误 | 'const' declarations must be initialized | 必须初始化 "const" 声明 |
1156 | 错误 | 'const' declarations can only be declared inside a block. | "const" 声明只能在块的内部声明。 |
1157 | 错误 | 'let' declarations can only be declared inside a block. | "let" 声明只能在块的内部声明。 |
1160 | 错误 | Unterminated template literal. | 未终止的模板文本。 |
1161 | 错误 | Unterminated regular expression literal. | 未终止的正则表达式文本。 |
1162 | 错误 | An object member cannot be declared optional. | 对象成员无法声明为可选。 |
1163 | 错误 | A 'yield' expression is only allowed in a generator body. | 只允许在生成器正文中使用 "yield" 表达式。 |
1164 | 错误 | Computed property names are not allowed in enums. | 枚举中不允许计算属性名。 |
1165 | 错误 | A computed property name in an ambient context must directly refer to a built-in symbol. | 环境上下文中的计算属性名必须直接引用内置符号。 |
1166 | 错误 | A computed property name in a class property declaration must directly refer to a built-in symbol. | 类属性声明中的计算属性名必须直接引用内置符号。 |
1168 | 错误 | A computed property name in a method overload must directly refer to a built-in symbol. | 方法重载中的计算属性名必须直接引用内置符号。 |
1169 | 错误 | A computed property name in an interface must directly refer to a built-in symbol. | 接口中的计算属性名必须直接引用内置符号。 |
1170 | 错误 | A computed property name in a type literal must directly refer to a built-in symbol. | 类型文本中的计算属性名必须直接引用内置符号。 |
1171 | 错误 | A comma expression is not allowed in a computed property name. | 计算属性名中不允许逗号表达式。 |
1172 | 错误 | 'extends' clause already seen. | 已看到 "extends" 子句。 |
1173 | 错误 | 'extends' clause must precede 'implements' clause. | "extends" 子句必须位于 "implements" 子句之前。 |
1174 | 错误 | Classes can only extend a single class. | 类只能扩展一个类。 |
1175 | 错误 | 'implements' clause already seen. | 已看到 "implements" 子句。 |
1176 | 错误 | Interface declaration cannot have 'implements' clause. | 接口声明不能有 "implements" 子句。 |
1177 | 错误 | Binary digit expected. | 需要二进制数字。 |
1178 | 错误 | Octal digit expected. | 需要八进制数字。 |
1179 | 错误 | Unexpected token. '{' expected. | 意外标记。应为 "{"。 |
1180 | 错误 | Property destructuring pattern expected. | 应为属性析构模式。 |
1181 | 错误 | Array element destructuring pattern expected. | 应为数组元素析构模式。 |
1182 | 错误 | A destructuring declaration must have an initializer. | 析构声明必须具有初始化表达式。 |
1183 | 错误 | An implementation cannot be declared in ambient contexts. | 不能在环境上下文中声明实现。 |
1184 | 错误 | Modifiers cannot appear here. | 修饰符不能出现在此处。 |
1185 | 错误 | Merge conflict marker encountered. | 遇到合并冲突标记。 |
1186 | 错误 | A rest element cannot have an initializer. | rest 元素不能具有初始化表达式。 |
1187 | 错误 | A parameter property may not be declared using a binding pattern. | 参数属性不能为绑定模式。 |
1188 | 错误 | Only a single variable declaration is allowed in a 'for...of' statement. | "for...of" 语句中只允许单个变量声明。 |
1189 | 错误 | The variable declaration of a 'for...in' statement cannot have an initializer. | "for...in" 语句的变量声明不能有初始化表达式。 |
1190 | 错误 | The variable declaration of a 'for...of' statement cannot have an initializer. | "for...of" 语句的变量声明不能有初始化表达式。 |
1191 | 错误 | An import declaration cannot have modifiers. | 导入声明不能有修饰符。 |
1192 | 错误 | Module '{0}' has no default export. | 模块“{0}”没有默认导出。 |
1193 | 错误 | An export declaration cannot have modifiers. | 导出声明不能有修饰符。 |
1194 | 错误 | Export declarations are not permitted in a namespace. | 命名空间中不允许有导出声明。 |
1196 | 错误 | Catch clause variable cannot have a type annotation. | Catch 子句变量不能有类型批注。 |
1197 | 错误 | Catch clause variable cannot have an initializer. | Catch 子句变量不能有初始化表达式。 |
1198 | 错误 | An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive. | 扩展的 Unicode 转义值必须介于(含) 0x0 和 0x10FFFF 之间。 |
1199 | 错误 | Unterminated Unicode escape sequence. | 未终止的 Unicode 转义序列。 |
1200 | 错误 | Line terminator not permitted before arrow. | 箭头前不允许有行终止符。 |
1202 | 错误 | Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. | 当面向 ECMAScript 6 模块时,不能使用导入分配。请考虑改用 "import * as ns from "mod"" 、"import {a} from "mod"" 或 "import d from "mod"" 或其他模块格式。 |
1203 | 错误 | Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead. | 当面向 ECMAScript 6 模块时,不能使用导出分配。请考虑改用“导出默认”或其他模块格式。 |
1206 | 错误 | Decorators are not valid here. | 修饰器在此处无效。 |
1207 | 错误 | Decorators cannot be applied to multiple get/set accessors of the same name. | 不能向多个同名的 get/set 访问器应用修饰器。 |
1208 | 错误 | Cannot compile namespaces when the '--isolatedModules' flag is provided. | 提供 "--isolatedModules" 标志时无法编译命名空间。 |
1209 | 错误 | Ambient const enums are not allowed when the '--isolatedModules' flag is provided. | 提供 "--isolatedModules" 标志的情况下不允许使用环境常数枚举。 |
1210 | 错误 | Invalid use of '{0}'. Class definitions are automatically in strict mode. | “{0}”的使用无效。类定义自动处于严格模式。 |
1211 | 错误 | A class declaration without the 'default' modifier must have a name | 不带 "default" 修饰符的类声明必须具有名称 |
1212 | 错误 | Identifier expected. '{0}' is a reserved word in strict mode | 应为标识符。“{0}”在严格模式下是保留字 |
1213 | 错误 | Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode. | 应为标识符。“{0}”在严格模式下是保留字。类定义自动处于严格模式。 |
1214 | 错误 | Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode. | 应为标识符。“{0}”是严格模式下的保留字。模块自动处于严格模式。 |
1215 | 错误 | Invalid use of '{0}'. Modules are automatically in strict mode. | “{0}”的使用无效。模块自动处于严格模式。 |
1218 | 错误 | Export assignment is not supported when '--module' flag is 'system'. | 当 "--module" 标志是 "system" 时不支持导出分配。 |
1219 | 错误 | Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. | Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. |
1220 | 错误 | Generators are only available when targeting ECMAScript 2015 or higher. | 仅当面向 ECMAScript 6 或更高版本时,生成器才可用。 |
1221 | 错误 | Generators are not allowed in an ambient context. | 不允许在环境上下文中使用生成器。 |
1222 | 错误 | An overload signature cannot be declared as a generator. | 重载签名无法声明为生成器。 |
1223 | 错误 | '{0}' tag already specified. | 已指定“{0}”标记。 |
1224 | 错误 | Signature '{0}' must have a type predicate. | 签名“{0}”必须具有类型谓词。 |
1225 | 错误 | Cannot find parameter '{0}'. | 找不到参数“{0}”。 |
1226 | 错误 | Type predicate '{0}' is not assignable to '{1}'. | 类型谓词“{0}”不可分配给“{1}”。 |
1227 | 错误 | Parameter '{0}' is not in the same position as parameter '{1}'. | 参数“{0}”和参数“{1}”的位置不一样。 |
1228 | 错误 | A type predicate is only allowed in return type position for functions and methods. | 只允许在函数和方法的返回类型位置使用类型谓词。 |
1229 | 错误 | A type predicate cannot reference a rest parameter. | 类型谓词无法引用 rest 参数。 |
1230 | 错误 | A type predicate cannot reference element '{0}' in a binding pattern. | 类型谓词无法在绑定模式中引用元素“{0}”。 |
1231 | 错误 | An export assignment can only be used in a module. | 导出分配只能在模块中使用。 |
1232 | 错误 | An import declaration can only be used in a namespace or module. | 导入声明只能在命名空间或模块中使用。 |
1233 | 错误 | An export declaration can only be used in a module. | 导出声明只能在模块中使用。 |
1234 | 错误 | An ambient module declaration is only allowed at the top level in a file. | 只允许在文件的顶层中使用环境模块声明。 |
1235 | 错误 | A namespace declaration is only allowed in a namespace or module. | 只允许在命名空间或模块中使用命名空间声明。 |
1236 | 错误 | The return type of a property decorator function must be either 'void' or 'any'. | 属性修饰器函数的返回类型必须为 "void" 或 "any"。 |
1237 | 错误 | The return type of a parameter decorator function must be either 'void' or 'any'. | 参数修饰器函数的返回类型必须为 "void" 或 "any"。 |
1238 | 错误 | Unable to resolve signature of class decorator when called as an expression. | 作为表达式调用时,无法解析类修饰器的签名。 |
1239 | 错误 | Unable to resolve signature of parameter decorator when called as an expression. | 作为表达式调用时,无法解析参数修饰器的签名。 |
1240 | 错误 | Unable to resolve signature of property decorator when called as an expression. | 作为表达式调用时,无法解析属性修饰器的签名。 |
1241 | 错误 | Unable to resolve signature of method decorator when called as an expression. | 作为表达式调用时,无法解析方法修饰器的签名。 |
1242 | 错误 | 'abstract' modifier can only appear on a class, method, or property declaration. | "abstract" 修饰符只能出现在类声明或方法声明中。 |
1243 | 错误 | '{0}' modifier cannot be used with '{1}' modifier. | “{0}”修饰符不能与“{1}”修饰符一起使用。 |
1244 | 错误 | Abstract methods can only appear within an abstract class. | 抽象方法只能出现在抽象类中。 |
1245 | 错误 | Method '{0}' cannot have an implementation because it is marked abstract. | 方法“{0}”不能具有实现,因为它标记为抽象。 |
1246 | 错误 | An interface property cannot have an initializer. | 接口函数不能具有初始化表达式。 |
1247 | 错误 | A type literal property cannot have an initializer. | 类型文字数据不可具有初始化表达式。 |
1248 | 错误 | A class member cannot have the '{0}' keyword. | A class member cannot have the '{0}' keyword. |
1249 | 错误 | A decorator can only decorate a method implementation, not an overload. | A decorator can only decorate a method implementation, not an overload. |
1250 | 错误 | Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. | |
1251 | 错误 | Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode. | |
1252 | 错误 | Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode. | |
1253 | 错误 | '{0}' tag cannot be used independently as a top level JSDoc tag. | |
1254 | 错误 | A 'const' initializer in an ambien |