TypeScript报错信息表(备注)

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 
攻城狮Lee丶 CSDN认证博客专家 小区编程大赛银奖 幼儿园网络顾问 植发门店终身会员
一个奇葩的程序员,外冷内热,有点闷骚 ,生活状态下是个逗比,工作时是个完美主义者。....................
已标记关键词 清除标记
相关推荐
<div><p>Hia, trying to run all the definately typed files x.def.ts thru C:\A\N\node_modules\tern\bin\from_ts or more directly just calling ts.translate(txt, name) and am getting the following error at tern\lib\typescript.js:61:25</p> <p>var name = identifier.text(); ^ TypeError: Cannot call method 'text' of undefined at addToObj (C:\A\N\node_modules\tern\lib\typescript.js:61:25) at objType (C:\A\N\node_modules\tern\lib\typescript.js:112:7) at objType (C:\A\N\node_modules\tern\lib\typescript.js:105:25) at objType (C:\A\N\node_modules\tern\lib\typescript.js:98:59) at Object.exports.translate (C:\A\N\node_modules\tern\lib\typescript.js:201:14) at finish (C:\A\N\node_modules\tern\bin\from_ts:33:33) at module.exports (C:\A\N\node_modules\tern\bin\from_ts:37:1) at Object. (C:\A\N\node_modules\ulexite_E_x00x2014x07x23x10.js:2:48) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10)</p> <p>at first it was this bit</p> <p>// The TypeScript code is all there in the npm package, but it's not // exporting anything as a CommonJS module, so we use this kludge to // get at its internals. var tsFileName = __dirname + "/../node_modules/typescript/bin/typescript.js"; var tsFileName = "C:/A/N/node_modules/typescript/bin/typescript.js"; // the MS one right? var box = {}; for (var prop in global) box[prop] = global[prop];</p> <p>But the full path worked ok until line 61 is returning sometimes , but mainly ts.translate(txt, name) is blank or the above error</p> <p>name= path.basename("C:/A/B/2/J1/Ax/62/jx/d.ts") == "d.ts" can name be anything? what is the importance of this name? (i have just like d.ts, etc)</p> <p>line 61 is this bit...</p> <p>function addToObj(data, identifier, val) { var known = data[name]; var name = identifier.text(); ----line 61 is here if (/^".*"$/.test(name)) name = name.slice(1, name.length - 1); if (known) {<!-- --></p> <p>i think the kludge works!!! since tn and ts return...</p> <p>{ '0': 'None', '1': 'List', '2': 'SeparatedList', '3': 'TriviaList', '4': 'WhitespaceTrivia', '5': 'NewLineTrivia', '6': 'MultiLineCommentTrivia', '7': 'SingleLineCommentTrivia', '8': 'SkippedTokenTrivia', '9': 'FirstToken', '10': 'EndOfFileToken', '11': 'IdentifierName', '12': 'RegularExpressionLiteral', '13': 'NumericLiteral', '14': 'StringLiteral', '15': 'FirstFixedWidth', '16': 'CaseKeyword', '17': 'CatchKeyword', '18': 'ContinueKeyword', '19': 'DebuggerKeyword', '20': 'DefaultKeyword', '21': 'DeleteKeyword',</p> <p>and ts...</p> <p>{ DiagnosticCode: { error_TS_0_1: 'error TS{0}: {1}', warning_TS_0_1: 'warning TS{0}: {1}', Unrecognized_escape_sequence: 'Unrecognized escape sequence.', Unexpected_character_0: 'Unexpected character {0}.', Missing_close_quote_character: 'Missing close quote character.', Identifier_expected: 'Identifier expected.', _0_keyword_expected: '\'{0}\' keyword expected.', _0_expected: '\'{0}\' expected.', Identifier_expected_0_is_a_keyword: 'Identifier expected; \'{0}\' is a keyword.', Automatic_semicolon_insertion_not_allowed: 'Automatic semicolon insertion not allowed.', Unexpected_token_0_expected: 'Unexpected token; \'{0}\' expected.', Trailing_separator_not_allowed: 'Trailing separator not allowed.', AsteriskSlash_expected: '\'*/\' expected.', public_or_private_modifier_must_precede_static: '\'public\' or \'private\' modifier must precede \'static\'.', Unexpected_token: 'Unexpected token.', Catch_clause_parameter_cannot_have_a_type_annotation: 'Catch clause parameter cannot have a type annotation.', Rest_parameter_must_be_last_in_list: 'Rest parameter must be last in list.', Parameter_cannot_have_question_mark_and_initializer: 'Parameter cannot have question mark and initializer.', Required_parameter_cannot_follow_optional_parameter: 'Required parameter cannot follow optional parameter.', Index_signatures_cannot_have_rest_parameters: 'Index signatures cannot have rest parameters.', Index_signature_parameter_cannot_have_accessibility_modifiers: 'Index signature parameter cannot have accessibility modifiers.', Index_signature_parameter_cannot_have_a_question_mark: 'Index signature parameter cannot have a question mark.', Index_signature_parameter_cannot_have_an_initializer: 'Index signature parameter cannot have an initializer.', Index_signature_must_have_a_type_annotation: 'Index signature must have a type annotation.', Index_signature_parameter_must_have_a_type_annotation: 'Index signature parameter must have a type annotation.', Index_signature_parameter_type_must_be_string_or_number: 'Index signature parameter type must be \'string\' or \'number\'.', extends_clause_already_seen: '\'extends\' clause already seen.', extends_clause_must_precede_implements_clause: '\'extends\' </p><p>该提问来源于开源项目:ternjs/tern</p></div>
©️2020 CSDN 皮肤主题: 猿与汪的秘密 设计师:白松林 返回首页
实付 19.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值