From c31ad6fb28e9daed09d585558edfc2f39ad4a3a7 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Aug 2015 18:09:32 -0700 Subject: [PATCH 01/75] Add tslint rules for #3994 --- Jakefile.js | 21 ++++++++- scripts/tslint/nextLineRule.ts | 63 +++++++++++++++++++++++++ scripts/tslint/noInferrableTypesRule.ts | 32 +++++++++++++ scripts/tslint/tsconfig.json | 7 +++ tslint.json | 15 ++++-- 5 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 scripts/tslint/nextLineRule.ts create mode 100644 scripts/tslint/noInferrableTypesRule.ts create mode 100644 scripts/tslint/tsconfig.json diff --git a/Jakefile.js b/Jakefile.js index ea13cce6685..b30af95201a 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -770,17 +770,34 @@ task("update-sublime", ["local", serverFile], function() { jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/"); }); +var tslintRuleDir = "scripts/tslint"; +var tslintRules = ([ + "nextLineRule", + "noInferrableTypesRule" +]); +var tslintRulesFiles = tslintRules.map(function(p) { + return path.join(tslintRuleDir, p + ".ts"); +}); +var tslintRulesOutFiles = tslintRules.map(function(p) { + return path.join(builtLocalDirectory, "tslint", p + ".js"); +}); +desc("Compiles tslint rules to js"); +task("build-rules", tslintRulesOutFiles); +tslintRulesFiles.forEach(function(ruleFile, i) { + compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ true, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint")); +}); + // if the codebase were free of linter errors we could make jake runtests // run this task automatically desc("Runs tslint on the compiler sources"); -task("lint", [], function() { +task("lint", ["build-rules"], function() { function success(f) { return function() { console.log('SUCCESS: No linter errors in ' + f + '\n'); }}; function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }}; var lintTargets = compilerSources.concat(harnessCoreSources); for (var i in lintTargets) { var f = lintTargets[i]; - var cmd = 'tslint -c tslint.json ' + f; + var cmd = 'tslint --rules-dir built/local/tslint -c tslint.json ' + f; exec(cmd, success(f), failure(f)); } }, { async: true }); diff --git a/scripts/tslint/nextLineRule.ts b/scripts/tslint/nextLineRule.ts new file mode 100644 index 00000000000..f1288e8e2f0 --- /dev/null +++ b/scripts/tslint/nextLineRule.ts @@ -0,0 +1,63 @@ +/// +/// + +const OPTION_CATCH = "check-catch"; +const OPTION_ELSE = "check-else"; + +export class Rule extends Lint.Rules.AbstractRule { + public static CATCH_FAILURE_STRING = "'catch' should be on the line following the previous block's ending curly brace"; + public static ELSE_FAILURE_STRING = "'else' should be on the line following the previous block's ending curly brace"; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + return this.applyWithWalker(new NextLineWalker(sourceFile, this.getOptions())); + } +} + +class NextLineWalker extends Lint.RuleWalker { + public visitIfStatement(node: ts.IfStatement) { + const sourceFile = node.getSourceFile(); + const thenStatement = node.thenStatement; + + const elseStatement = node.elseStatement; + if (!!elseStatement) { + // find the else keyword + const elseKeyword = getFirstChildOfKind(node, ts.SyntaxKind.ElseKeyword); + if (this.hasOption(OPTION_ELSE) && !!elseKeyword) { + const thenStatementEndLoc = sourceFile.getLineAndCharacterOfPosition(thenStatement.getEnd()); + const elseKeywordLoc = sourceFile.getLineAndCharacterOfPosition(elseKeyword.getStart()); + if (thenStatementEndLoc.line !== (elseKeywordLoc.line - 1)) { + const failure = this.createFailure(elseKeyword.getStart(), elseKeyword.getWidth(), Rule.ELSE_FAILURE_STRING); + this.addFailure(failure); + } + } + } + + super.visitIfStatement(node); + } + + public visitTryStatement(node: ts.TryStatement) { + const sourceFile = node.getSourceFile(); + const catchClause = node.catchClause; + + // "visit" try block + const tryKeyword = node.getChildAt(0); + const tryBlock = node.tryBlock; + const tryOpeningBrace = tryBlock.getChildAt(0); + + if (this.hasOption(OPTION_CATCH) && !!catchClause) { + const tryClosingBrace = node.tryBlock.getChildAt(node.tryBlock.getChildCount() - 1); + const catchKeyword = catchClause.getChildAt(0); + const tryClosingBraceLoc = sourceFile.getLineAndCharacterOfPosition(tryClosingBrace.getEnd()); + const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart()); + if (tryClosingBraceLoc.line !== (catchKeywordLoc.line - 1)) { + const failure = this.createFailure(catchKeyword.getStart(), catchKeyword.getWidth(), Rule.CATCH_FAILURE_STRING); + this.addFailure(failure); + } + } + super.visitTryStatement(node); + } +} + +function getFirstChildOfKind(node: ts.Node, kind: ts.SyntaxKind) { + return node.getChildren().filter((child) => child.kind === kind)[0]; +} \ No newline at end of file diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts new file mode 100644 index 00000000000..806426dc9f9 --- /dev/null +++ b/scripts/tslint/noInferrableTypesRule.ts @@ -0,0 +1,32 @@ +/// +/// + + +export class Rule extends Lint.Rules.AbstractRule { + public static FAILURE_STRING = "LHS type inferred by RHS expression, remove type annotation"; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + const program = ts.createProgram([sourceFile.fileName], Lint.createCompilerOptions()); + return this.applyWithWalker(new InferrableTypeWalker(sourceFile, this.getOptions(), program)); + } +} + +class InferrableTypeWalker extends Lint.RuleWalker { + constructor(file: ts.SourceFile, opts: Lint.IOptions, private program: ts.Program) { + super(program.getSourceFile(file.fileName), opts); + } + + visitVariableStatement(node: ts.VariableStatement) { + node.declarationList.declarations.forEach(e => { + if ( + (!!e.type) && + (!!e.initializer) && + (this.program.getTypeChecker().getTypeAtLocation(e.type) === this.program.getTypeChecker().getContextualType(e.initializer)) + ) { + this.addFailure(this.createFailure(e.type.getStart(), e.type.getWidth(), Rule.FAILURE_STRING)); + } + }); + + super.visitVariableStatement(node); + } +} diff --git a/scripts/tslint/tsconfig.json b/scripts/tslint/tsconfig.json new file mode 100644 index 00000000000..db018ce2776 --- /dev/null +++ b/scripts/tslint/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "noImplicitAny": true, + "module": "commonjs", + "outDir": "../../built/local/tslint" + } +} \ No newline at end of file diff --git a/tslint.json b/tslint.json index 71dc6730de4..2cc6cf80c92 100644 --- a/tslint.json +++ b/tslint.json @@ -8,7 +8,8 @@ "spaces" ], "one-line": [true, - "check-open-brace" + "check-open-brace", + "check-whitespace" ], "no-unreachable": true, "no-use-before-declare": true, @@ -21,7 +22,8 @@ "check-branch", "check-operator", "check-separator", - "check-type" + "check-type", + "check-module" ], "typedef-whitespace": [true, { "call-signature": "nospace", @@ -29,6 +31,13 @@ "parameter": "nospace", "property-declaration": "nospace", "variable-declaration": "nospace" - }] + }], + "next-line": [true, + "check-catch", + "check-else" + ], + "no-internal-module": true, + "no-trailing-whitespace": true, + "no-inferrable-types": true } } From 7813121c4d77e50aad0eed3152ef1f1156c7b574 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 25 Aug 2015 18:37:52 -0700 Subject: [PATCH 02/75] compile vs tslints services dts, null check lint --- Jakefile.js | 3 ++- scripts/tslint/nextLineRule.ts | 2 +- scripts/tslint/noInferrableTypesRule.ts | 2 +- scripts/tslint/noNullRule.ts | 20 ++++++++++++++++++++ tslint.json | 3 ++- 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 scripts/tslint/noNullRule.ts diff --git a/Jakefile.js b/Jakefile.js index b30af95201a..d8f2355abb7 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -773,7 +773,8 @@ task("update-sublime", ["local", serverFile], function() { var tslintRuleDir = "scripts/tslint"; var tslintRules = ([ "nextLineRule", - "noInferrableTypesRule" + "noInferrableTypesRule", + "noNullRule" ]); var tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); diff --git a/scripts/tslint/nextLineRule.ts b/scripts/tslint/nextLineRule.ts index f1288e8e2f0..8e24aea45e5 100644 --- a/scripts/tslint/nextLineRule.ts +++ b/scripts/tslint/nextLineRule.ts @@ -1,4 +1,4 @@ -/// +/// /// const OPTION_CATCH = "check-catch"; diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts index 806426dc9f9..16e0633c872 100644 --- a/scripts/tslint/noInferrableTypesRule.ts +++ b/scripts/tslint/noInferrableTypesRule.ts @@ -1,4 +1,4 @@ -/// +/// /// diff --git a/scripts/tslint/noNullRule.ts b/scripts/tslint/noNullRule.ts new file mode 100644 index 00000000000..2a2c5bc3717 --- /dev/null +++ b/scripts/tslint/noNullRule.ts @@ -0,0 +1,20 @@ +/// +/// + + +export class Rule extends Lint.Rules.AbstractRule { + public static FAILURE_STRING = "Don't use the 'null' keyword - use 'undefined' for missing values instead"; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + return this.applyWithWalker(new NullWalker(sourceFile, this.getOptions())); + } +} + +class NullWalker extends Lint.RuleWalker { + visitNode(node: ts.Node) { + super.visitNode(node); + if (node.kind === ts.SyntaxKind.NullKeyword) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + } +} diff --git a/tslint.json b/tslint.json index 2cc6cf80c92..4791e7c937c 100644 --- a/tslint.json +++ b/tslint.json @@ -38,6 +38,7 @@ ], "no-internal-module": true, "no-trailing-whitespace": true, - "no-inferrable-types": true + "no-inferrable-types": true, + "no-null": true } } From 1cd016b2892d923d7da41130adb48d7713d83d14 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 26 Aug 2015 11:59:53 -0700 Subject: [PATCH 03/75] Boolean trivia rule --- Jakefile.js | 3 +- scripts/tslint/booleanTriviaRule.ts | 50 +++++++++++++++++++++++++++++ tslint.json | 3 +- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 scripts/tslint/booleanTriviaRule.ts diff --git a/Jakefile.js b/Jakefile.js index d8f2355abb7..3d7c6d93baf 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -774,7 +774,8 @@ var tslintRuleDir = "scripts/tslint"; var tslintRules = ([ "nextLineRule", "noInferrableTypesRule", - "noNullRule" + "noNullRule", + "booleanTriviaRule" ]); var tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); diff --git a/scripts/tslint/booleanTriviaRule.ts b/scripts/tslint/booleanTriviaRule.ts new file mode 100644 index 00000000000..be32a870ff4 --- /dev/null +++ b/scripts/tslint/booleanTriviaRule.ts @@ -0,0 +1,50 @@ +/// +/// + + +export class Rule extends Lint.Rules.AbstractRule { + public static FAILURE_STRING_FACTORY = (name: string, currently: string) => `Tag boolean argument as '${name}' (currently '${currently}')`; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + const program = ts.createProgram([sourceFile.fileName], Lint.createCompilerOptions()); + const checker = program.getTypeChecker(); + return this.applyWithWalker(new BooleanTriviaWalker(checker, program.getSourceFile(sourceFile.fileName), this.getOptions())); + } +} + +class BooleanTriviaWalker extends Lint.RuleWalker { + constructor(private checker: ts.TypeChecker, file: ts.SourceFile, opts: Lint.IOptions) { + super(file, opts); + } + + visitCallExpression(node: ts.CallExpression) { + super.visitCallExpression(node); + if (node.arguments) { + const targetCallSignature = this.checker.getResolvedSignature(node); + if (!!targetCallSignature) { + const targetParameters = targetCallSignature.getParameters(); + const source = this.getSourceFile(); + for (let index = 0; index < targetParameters.length; index++) { + const param = targetParameters[index]; + const arg = node.arguments[index]; + if (!(arg && param)) continue; + + const argType = this.checker.getContextualType(arg); + if (argType && (argType.getFlags() & ts.TypeFlags.Boolean)) { + if (arg.kind !== ts.SyntaxKind.TrueKeyword && arg.kind !== ts.SyntaxKind.FalseKeyword) { + continue; + } + let triviaContent: string; + const ranges = ts.getLeadingCommentRanges(arg.getFullText(), 0); + if (ranges && ranges.length === 1 && ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia) { + triviaContent = arg.getFullText().slice(ranges[0].pos + 2, ranges[0].end - 2); //+/-2 to remove /**/ + } + if (triviaContent !== param.getName()) { + this.addFailure(this.createFailure(arg.getStart(source), arg.getWidth(source), Rule.FAILURE_STRING_FACTORY(param.getName(), triviaContent))); + } + } + } + } + } + } +} diff --git a/tslint.json b/tslint.json index 4791e7c937c..1e83ef90ffe 100644 --- a/tslint.json +++ b/tslint.json @@ -39,6 +39,7 @@ "no-internal-module": true, "no-trailing-whitespace": true, "no-inferrable-types": true, - "no-null": true + "no-null": true, + "boolean-trivia": true } } From dc9dd3e667d9d99a487741f4633c7caad8df9515 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 26 Aug 2015 14:47:25 -0700 Subject: [PATCH 04/75] Give up on real typechecking, just check literals --- scripts/tslint/noInferrableTypesRule.ts | 46 ++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts index 16e0633c872..e1c6614170c 100644 --- a/scripts/tslint/noInferrableTypesRule.ts +++ b/scripts/tslint/noInferrableTypesRule.ts @@ -3,30 +3,52 @@ export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING = "LHS type inferred by RHS expression, remove type annotation"; + public static FAILURE_STRING_FACTORY = (type: string) => `LHS type (${type}) inferred by RHS expression, remove type annotation`; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - const program = ts.createProgram([sourceFile.fileName], Lint.createCompilerOptions()); - return this.applyWithWalker(new InferrableTypeWalker(sourceFile, this.getOptions(), program)); + return this.applyWithWalker(new InferrableTypeWalker(sourceFile, this.getOptions())); } } class InferrableTypeWalker extends Lint.RuleWalker { - constructor(file: ts.SourceFile, opts: Lint.IOptions, private program: ts.Program) { - super(program.getSourceFile(file.fileName), opts); + private originalService: ts.LanguageService; + private fileName: string; + private originalContent: string; + + constructor(file: ts.SourceFile, opts: Lint.IOptions) { + this.fileName = file.fileName; + this.originalContent = file.getFullText(); + this.originalService = ts.createLanguageService(Lint.createLanguageServiceHost(this.fileName, this.originalContent)); + super(this.originalService.getSourceFile(this.fileName), opts); } visitVariableStatement(node: ts.VariableStatement) { node.declarationList.declarations.forEach(e => { - if ( - (!!e.type) && - (!!e.initializer) && - (this.program.getTypeChecker().getTypeAtLocation(e.type) === this.program.getTypeChecker().getContextualType(e.initializer)) - ) { - this.addFailure(this.createFailure(e.type.getStart(), e.type.getWidth(), Rule.FAILURE_STRING)); + if ((!!e.type) && (!!e.initializer)) { + let failure: string; + switch (e.type.kind) { + case ts.SyntaxKind.BooleanKeyword: + if (e.initializer.kind === ts.SyntaxKind.TrueKeyword || e.initializer.kind === ts.SyntaxKind.FalseKeyword) { + failure = 'boolean'; + } + break; + case ts.SyntaxKind.NumberKeyword: + if (e.initializer.kind === ts.SyntaxKind.NumericLiteral) { + failure = 'number'; + } + break; + case ts.SyntaxKind.StringKeyword: + if (e.initializer.kind === ts.SyntaxKind.StringLiteral || e.initializer.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) { + failure = 'string'; + } + break; + } + if (failure) { + this.addFailure(this.createFailure(e.type.getStart(), e.type.getWidth(), Rule.FAILURE_STRING_FACTORY(failure))); + } } }); - + super.visitVariableStatement(node); } } From 0d88d8df68dca5704d5234a512fad371463bd920 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 26 Aug 2015 14:48:52 -0700 Subject: [PATCH 05/75] Simplify it a bit --- scripts/tslint/noInferrableTypesRule.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts index e1c6614170c..1dae47971eb 100644 --- a/scripts/tslint/noInferrableTypesRule.ts +++ b/scripts/tslint/noInferrableTypesRule.ts @@ -11,17 +11,6 @@ export class Rule extends Lint.Rules.AbstractRule { } class InferrableTypeWalker extends Lint.RuleWalker { - private originalService: ts.LanguageService; - private fileName: string; - private originalContent: string; - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - this.fileName = file.fileName; - this.originalContent = file.getFullText(); - this.originalService = ts.createLanguageService(Lint.createLanguageServiceHost(this.fileName, this.originalContent)); - super(this.originalService.getSourceFile(this.fileName), opts); - } - visitVariableStatement(node: ts.VariableStatement) { node.declarationList.declarations.forEach(e => { if ((!!e.type) && (!!e.initializer)) { From 9d3907ffbe9f35f17616850188f3d167f01c7a14 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 1 Sep 2015 16:09:44 -0700 Subject: [PATCH 06/75] Added declaration option to empty destructuring tests. --- .../es6/destructuring/emptyArrayBindingPatternParameter01.ts | 2 +- .../es6/destructuring/emptyArrayBindingPatternParameter02.ts | 2 +- .../es6/destructuring/emptyArrayBindingPatternParameter03.ts | 2 +- .../es6/destructuring/emptyArrayBindingPatternParameter04.ts | 2 +- .../es6/destructuring/emptyAssignmentPatterns01_ES5.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns01_ES6.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns02_ES5.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns02_ES6.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns03_ES5.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns03_ES6.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns04_ES5.ts | 1 + .../es6/destructuring/emptyAssignmentPatterns04_ES6.ts | 1 + .../es6/destructuring/emptyObjectBindingPatternParameter01.ts | 2 +- .../es6/destructuring/emptyObjectBindingPatternParameter02.ts | 2 +- .../es6/destructuring/emptyObjectBindingPatternParameter03.ts | 2 +- .../es6/destructuring/emptyObjectBindingPatternParameter04.ts | 2 +- 16 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts index 64b198b0916..90e25765847 100644 --- a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts +++ b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f([]) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts index 39663a4bed7..e9e99c6d0eb 100644 --- a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts +++ b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f(a, []) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts index 39663a4bed7..e9e99c6d0eb 100644 --- a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts +++ b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f(a, []) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts index 313d4fe6708..7f57c6a6acf 100644 --- a/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts +++ b/tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f([] = [1,2,3,4]) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts index dd10e552615..44175dbb63a 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5.ts @@ -1,4 +1,5 @@ // @target: es5 +// @declaration: true var a: any; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts index 043f0cf1108..4f367ee8853 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES6.ts @@ -1,4 +1,5 @@ // @target: es6 +// @declaration: true var a: any; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts index 60fe89758d6..1d291425e67 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5.ts @@ -1,4 +1,5 @@ // @target: es5 +// @declaration: true var a: any; let x, y, z, a1, a2, a3; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts index 295401545d4..b156883f7d2 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES6.ts @@ -1,4 +1,5 @@ // @target: es6 +// @declaration: true var a: any; let x, y, z, a1, a2, a3; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts index 080c828ad62..dbe79355cd8 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5.ts @@ -1,4 +1,5 @@ // @target: es5 +// @declaration: true var a: any; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts index 10d67254cd8..d86f01f5c79 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES6.ts @@ -1,4 +1,5 @@ // @target: es6 +// @declaration: true var a: any; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts index 0233ddcda70..ac79e87a11c 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5.ts @@ -1,4 +1,5 @@ // @target: es5 +// @declaration: true var a: any; let x, y, z, a1, a2, a3; diff --git a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts index 3380a56aaa7..25e56c353b9 100644 --- a/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES6.ts @@ -1,4 +1,5 @@ // @target: es6 +// @declaration: true var a: any; let x, y, z, a1, a2, a3; diff --git a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts index 01aa5b54230..270d7f10227 100644 --- a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts +++ b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f({}) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts index f34503c1152..79d026eac9e 100644 --- a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts +++ b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f(a, {}) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts index a940c659703..c5d51b20cfa 100644 --- a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts +++ b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f({}, a) { var x, y, z; diff --git a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts index da05e5cb428..0273e174de0 100644 --- a/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts +++ b/tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts @@ -1,4 +1,4 @@ - +// @declaration: true function f({} = {a: 1, b: "2", c: true}) { var x, y, z; From 232e33e8547324dda065402ec9bd94a6ded7a115 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 1 Sep 2015 17:22:13 -0700 Subject: [PATCH 07/75] Accepted baselines. --- .../emptyArrayBindingPatternParameter01.js | 5 ++++- .../emptyArrayBindingPatternParameter01.symbols | 7 +++---- .../emptyArrayBindingPatternParameter01.types | 1 - .../emptyArrayBindingPatternParameter02.js | 5 ++++- .../emptyArrayBindingPatternParameter02.symbols | 9 ++++----- .../emptyArrayBindingPatternParameter02.types | 1 - .../emptyArrayBindingPatternParameter03.js | 5 ++++- .../emptyArrayBindingPatternParameter03.symbols | 9 ++++----- .../emptyArrayBindingPatternParameter03.types | 1 - .../emptyArrayBindingPatternParameter04.js | 5 ++++- .../emptyArrayBindingPatternParameter04.symbols | 7 +++---- .../emptyArrayBindingPatternParameter04.types | 1 - .../reference/emptyAssignmentPatterns01_ES5.js | 4 ++++ .../reference/emptyAssignmentPatterns01_ES6.js | 4 ++++ .../reference/emptyAssignmentPatterns02_ES5.js | 5 +++++ .../reference/emptyAssignmentPatterns02_ES6.js | 5 +++++ .../reference/emptyAssignmentPatterns03_ES5.js | 4 ++++ .../reference/emptyAssignmentPatterns03_ES6.js | 4 ++++ .../reference/emptyAssignmentPatterns04_ES5.js | 5 +++++ .../reference/emptyAssignmentPatterns04_ES6.js | 5 +++++ .../emptyObjectBindingPatternParameter01.js | 5 ++++- .../emptyObjectBindingPatternParameter01.symbols | 7 +++---- .../emptyObjectBindingPatternParameter01.types | 1 - .../emptyObjectBindingPatternParameter02.js | 5 ++++- .../emptyObjectBindingPatternParameter02.symbols | 9 ++++----- .../emptyObjectBindingPatternParameter02.types | 1 - .../emptyObjectBindingPatternParameter03.js | 5 ++++- .../emptyObjectBindingPatternParameter03.symbols | 9 ++++----- .../emptyObjectBindingPatternParameter03.types | 1 - .../emptyObjectBindingPatternParameter04.js | 9 ++++++++- .../emptyObjectBindingPatternParameter04.symbols | 13 ++++++------- .../emptyObjectBindingPatternParameter04.types | 1 - 32 files changed, 103 insertions(+), 55 deletions(-) diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter01.js b/tests/baselines/reference/emptyArrayBindingPatternParameter01.js index 5723c74f117..1eb76741e84 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter01.js +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter01.js @@ -1,6 +1,5 @@ //// [emptyArrayBindingPatternParameter01.ts] - function f([]) { var x, y, z; } @@ -9,3 +8,7 @@ function f([]) { function f(_a) { var x, y, z; } + + +//// [emptyArrayBindingPatternParameter01.d.ts] +declare function f([]: any[]): void; diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter01.symbols b/tests/baselines/reference/emptyArrayBindingPatternParameter01.symbols index f5089ce5850..e1630be639b 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter01.symbols +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter01.symbols @@ -1,11 +1,10 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts === - function f([]) { >f : Symbol(f, Decl(emptyArrayBindingPatternParameter01.ts, 0, 0)) var x, y, z; ->x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 3, 7)) ->y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 3, 10)) ->z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 3, 13)) +>x : Symbol(x, Decl(emptyArrayBindingPatternParameter01.ts, 2, 7)) +>y : Symbol(y, Decl(emptyArrayBindingPatternParameter01.ts, 2, 10)) +>z : Symbol(z, Decl(emptyArrayBindingPatternParameter01.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter01.types b/tests/baselines/reference/emptyArrayBindingPatternParameter01.types index 7ef40d52d59..4ca0b892ecf 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter01.types +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter01.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter01.ts === - function f([]) { >f : ([]: any[]) => void diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter02.js b/tests/baselines/reference/emptyArrayBindingPatternParameter02.js index dbd86e843a8..d6dda16e12f 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter02.js +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter02.js @@ -1,6 +1,5 @@ //// [emptyArrayBindingPatternParameter02.ts] - function f(a, []) { var x, y, z; } @@ -9,3 +8,7 @@ function f(a, []) { function f(a, _a) { var x, y, z; } + + +//// [emptyArrayBindingPatternParameter02.d.ts] +declare function f(a: any, []: any[]): void; diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter02.symbols b/tests/baselines/reference/emptyArrayBindingPatternParameter02.symbols index 48cdcfaf93d..3289c06f962 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter02.symbols +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter02.symbols @@ -1,12 +1,11 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts === - function f(a, []) { >f : Symbol(f, Decl(emptyArrayBindingPatternParameter02.ts, 0, 0)) ->a : Symbol(a, Decl(emptyArrayBindingPatternParameter02.ts, 2, 11)) +>a : Symbol(a, Decl(emptyArrayBindingPatternParameter02.ts, 1, 11)) var x, y, z; ->x : Symbol(x, Decl(emptyArrayBindingPatternParameter02.ts, 3, 7)) ->y : Symbol(y, Decl(emptyArrayBindingPatternParameter02.ts, 3, 10)) ->z : Symbol(z, Decl(emptyArrayBindingPatternParameter02.ts, 3, 13)) +>x : Symbol(x, Decl(emptyArrayBindingPatternParameter02.ts, 2, 7)) +>y : Symbol(y, Decl(emptyArrayBindingPatternParameter02.ts, 2, 10)) +>z : Symbol(z, Decl(emptyArrayBindingPatternParameter02.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter02.types b/tests/baselines/reference/emptyArrayBindingPatternParameter02.types index a58fe6b91d3..34d9e7dde6b 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter02.types +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter02.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter02.ts === - function f(a, []) { >f : (a: any, []: any[]) => void >a : any diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter03.js b/tests/baselines/reference/emptyArrayBindingPatternParameter03.js index e2c3f7196e6..4867b39ac2f 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter03.js +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter03.js @@ -1,6 +1,5 @@ //// [emptyArrayBindingPatternParameter03.ts] - function f(a, []) { var x, y, z; } @@ -9,3 +8,7 @@ function f(a, []) { function f(a, _a) { var x, y, z; } + + +//// [emptyArrayBindingPatternParameter03.d.ts] +declare function f(a: any, []: any[]): void; diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter03.symbols b/tests/baselines/reference/emptyArrayBindingPatternParameter03.symbols index d3ec078df78..86a95687310 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter03.symbols +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter03.symbols @@ -1,12 +1,11 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts === - function f(a, []) { >f : Symbol(f, Decl(emptyArrayBindingPatternParameter03.ts, 0, 0)) ->a : Symbol(a, Decl(emptyArrayBindingPatternParameter03.ts, 2, 11)) +>a : Symbol(a, Decl(emptyArrayBindingPatternParameter03.ts, 1, 11)) var x, y, z; ->x : Symbol(x, Decl(emptyArrayBindingPatternParameter03.ts, 3, 7)) ->y : Symbol(y, Decl(emptyArrayBindingPatternParameter03.ts, 3, 10)) ->z : Symbol(z, Decl(emptyArrayBindingPatternParameter03.ts, 3, 13)) +>x : Symbol(x, Decl(emptyArrayBindingPatternParameter03.ts, 2, 7)) +>y : Symbol(y, Decl(emptyArrayBindingPatternParameter03.ts, 2, 10)) +>z : Symbol(z, Decl(emptyArrayBindingPatternParameter03.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter03.types b/tests/baselines/reference/emptyArrayBindingPatternParameter03.types index 43f0af63ace..1c5579ebe36 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter03.types +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter03.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter03.ts === - function f(a, []) { >f : (a: any, []: any[]) => void >a : any diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter04.js b/tests/baselines/reference/emptyArrayBindingPatternParameter04.js index e0715499ffe..c9819c88f40 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter04.js +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter04.js @@ -1,6 +1,5 @@ //// [emptyArrayBindingPatternParameter04.ts] - function f([] = [1,2,3,4]) { var x, y, z; } @@ -10,3 +9,7 @@ function f(_a) { var _a = [1, 2, 3, 4]; var x, y, z; } + + +//// [emptyArrayBindingPatternParameter04.d.ts] +declare function f([]?: number[]): void; diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter04.symbols b/tests/baselines/reference/emptyArrayBindingPatternParameter04.symbols index bb76a2c5925..9f4c9bae0c6 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter04.symbols +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter04.symbols @@ -1,11 +1,10 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts === - function f([] = [1,2,3,4]) { >f : Symbol(f, Decl(emptyArrayBindingPatternParameter04.ts, 0, 0)) var x, y, z; ->x : Symbol(x, Decl(emptyArrayBindingPatternParameter04.ts, 3, 7)) ->y : Symbol(y, Decl(emptyArrayBindingPatternParameter04.ts, 3, 10)) ->z : Symbol(z, Decl(emptyArrayBindingPatternParameter04.ts, 3, 13)) +>x : Symbol(x, Decl(emptyArrayBindingPatternParameter04.ts, 2, 7)) +>y : Symbol(y, Decl(emptyArrayBindingPatternParameter04.ts, 2, 10)) +>z : Symbol(z, Decl(emptyArrayBindingPatternParameter04.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyArrayBindingPatternParameter04.types b/tests/baselines/reference/emptyArrayBindingPatternParameter04.types index 6f00a994f7b..834eb41b34d 100644 --- a/tests/baselines/reference/emptyArrayBindingPatternParameter04.types +++ b/tests/baselines/reference/emptyArrayBindingPatternParameter04.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyArrayBindingPatternParameter04.ts === - function f([] = [1,2,3,4]) { >f : ([]?: number[]) => void >[1,2,3,4] : number[] diff --git a/tests/baselines/reference/emptyAssignmentPatterns01_ES5.js b/tests/baselines/reference/emptyAssignmentPatterns01_ES5.js index b89db88e5e5..fe0a642c51e 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns01_ES5.js +++ b/tests/baselines/reference/emptyAssignmentPatterns01_ES5.js @@ -9,3 +9,7 @@ var a: any; var a; (a); (a); + + +//// [emptyAssignmentPatterns01_ES5.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns01_ES6.js b/tests/baselines/reference/emptyAssignmentPatterns01_ES6.js index fe311ac9061..4cf33452d98 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns01_ES6.js +++ b/tests/baselines/reference/emptyAssignmentPatterns01_ES6.js @@ -9,3 +9,7 @@ var a: any; var a; ({} = a); ([] = a); + + +//// [emptyAssignmentPatterns01_ES6.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5.js b/tests/baselines/reference/emptyAssignmentPatterns02_ES5.js index 7b9f1f402f9..27a0b5f9b61 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns02_ES5.js +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5.js @@ -11,3 +11,8 @@ var a; var x, y, z, a1, a2, a3; ((x = a.x, y = a.y, z = a.z, a)); ((a1 = a[0], a2 = a[1], a3 = a[2], a)); + + +//// [emptyAssignmentPatterns02_ES5.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES6.js b/tests/baselines/reference/emptyAssignmentPatterns02_ES6.js index e9783c7e57d..493246c9473 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns02_ES6.js +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES6.js @@ -11,3 +11,8 @@ var a; let x, y, z, a1, a2, a3; ({} = { x, y, z } = a); ([] = [a1, a2, a3] = a); + + +//// [emptyAssignmentPatterns02_ES6.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns03_ES5.js b/tests/baselines/reference/emptyAssignmentPatterns03_ES5.js index d9ff8ba9ede..adaad2e3b63 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns03_ES5.js +++ b/tests/baselines/reference/emptyAssignmentPatterns03_ES5.js @@ -9,3 +9,7 @@ var a: any; var a; (a); (a); + + +//// [emptyAssignmentPatterns03_ES5.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns03_ES6.js b/tests/baselines/reference/emptyAssignmentPatterns03_ES6.js index 95bfdfefa52..8050cc1e47a 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns03_ES6.js +++ b/tests/baselines/reference/emptyAssignmentPatterns03_ES6.js @@ -9,3 +9,7 @@ var a: any; var a; ({} = {} = a); ([] = [] = a); + + +//// [emptyAssignmentPatterns03_ES6.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5.js b/tests/baselines/reference/emptyAssignmentPatterns04_ES5.js index 7e342d08e39..e6b3cc7e3f2 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns04_ES5.js +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5.js @@ -12,3 +12,8 @@ var x, y, z, a1, a2, a3; (_a = a, x = _a.x, y = _a.y, z = _a.z, _a); (_b = a, a1 = _b[0], a2 = _b[1], a3 = _b[2], _b); var _a, _b; + + +//// [emptyAssignmentPatterns04_ES5.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES6.js b/tests/baselines/reference/emptyAssignmentPatterns04_ES6.js index eabc2678c05..fb52975d6d1 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns04_ES6.js +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES6.js @@ -11,3 +11,8 @@ var a; let x, y, z, a1, a2, a3; ({ x, y, z } = {} = a); ([a1, a2, a3] = [] = a); + + +//// [emptyAssignmentPatterns04_ES6.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter01.js b/tests/baselines/reference/emptyObjectBindingPatternParameter01.js index 28cc30d2a0b..6a8ec808cd0 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter01.js +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter01.js @@ -1,6 +1,5 @@ //// [emptyObjectBindingPatternParameter01.ts] - function f({}) { var x, y, z; } @@ -9,3 +8,7 @@ function f({}) { function f(_a) { var x, y, z; } + + +//// [emptyObjectBindingPatternParameter01.d.ts] +declare function f({}: {}): void; diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter01.symbols b/tests/baselines/reference/emptyObjectBindingPatternParameter01.symbols index 98829df994f..3ef5898c29a 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter01.symbols +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter01.symbols @@ -1,11 +1,10 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts === - function f({}) { >f : Symbol(f, Decl(emptyObjectBindingPatternParameter01.ts, 0, 0)) var x, y, z; ->x : Symbol(x, Decl(emptyObjectBindingPatternParameter01.ts, 3, 7)) ->y : Symbol(y, Decl(emptyObjectBindingPatternParameter01.ts, 3, 10)) ->z : Symbol(z, Decl(emptyObjectBindingPatternParameter01.ts, 3, 13)) +>x : Symbol(x, Decl(emptyObjectBindingPatternParameter01.ts, 2, 7)) +>y : Symbol(y, Decl(emptyObjectBindingPatternParameter01.ts, 2, 10)) +>z : Symbol(z, Decl(emptyObjectBindingPatternParameter01.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter01.types b/tests/baselines/reference/emptyObjectBindingPatternParameter01.types index c46569ea770..05ddc54719c 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter01.types +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter01.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter01.ts === - function f({}) { >f : ({}: {}) => void diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter02.js b/tests/baselines/reference/emptyObjectBindingPatternParameter02.js index 8488428ea51..be2bdcab298 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter02.js +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter02.js @@ -1,6 +1,5 @@ //// [emptyObjectBindingPatternParameter02.ts] - function f(a, {}) { var x, y, z; } @@ -9,3 +8,7 @@ function f(a, {}) { function f(a, _a) { var x, y, z; } + + +//// [emptyObjectBindingPatternParameter02.d.ts] +declare function f(a: any, {}: {}): void; diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter02.symbols b/tests/baselines/reference/emptyObjectBindingPatternParameter02.symbols index fb0fa946b6f..d5bb4f292aa 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter02.symbols +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter02.symbols @@ -1,12 +1,11 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts === - function f(a, {}) { >f : Symbol(f, Decl(emptyObjectBindingPatternParameter02.ts, 0, 0)) ->a : Symbol(a, Decl(emptyObjectBindingPatternParameter02.ts, 2, 11)) +>a : Symbol(a, Decl(emptyObjectBindingPatternParameter02.ts, 1, 11)) var x, y, z; ->x : Symbol(x, Decl(emptyObjectBindingPatternParameter02.ts, 3, 7)) ->y : Symbol(y, Decl(emptyObjectBindingPatternParameter02.ts, 3, 10)) ->z : Symbol(z, Decl(emptyObjectBindingPatternParameter02.ts, 3, 13)) +>x : Symbol(x, Decl(emptyObjectBindingPatternParameter02.ts, 2, 7)) +>y : Symbol(y, Decl(emptyObjectBindingPatternParameter02.ts, 2, 10)) +>z : Symbol(z, Decl(emptyObjectBindingPatternParameter02.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter02.types b/tests/baselines/reference/emptyObjectBindingPatternParameter02.types index 0a77fac8588..e2b485538e6 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter02.types +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter02.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter02.ts === - function f(a, {}) { >f : (a: any, {}: {}) => void >a : any diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter03.js b/tests/baselines/reference/emptyObjectBindingPatternParameter03.js index 0279744e386..320bfe2d0df 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter03.js +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter03.js @@ -1,6 +1,5 @@ //// [emptyObjectBindingPatternParameter03.ts] - function f({}, a) { var x, y, z; } @@ -9,3 +8,7 @@ function f({}, a) { function f(_a, a) { var x, y, z; } + + +//// [emptyObjectBindingPatternParameter03.d.ts] +declare function f({}: {}, a: any): void; diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter03.symbols b/tests/baselines/reference/emptyObjectBindingPatternParameter03.symbols index 4e658e21ccf..82a1bcee75b 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter03.symbols +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter03.symbols @@ -1,12 +1,11 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts === - function f({}, a) { >f : Symbol(f, Decl(emptyObjectBindingPatternParameter03.ts, 0, 0)) ->a : Symbol(a, Decl(emptyObjectBindingPatternParameter03.ts, 2, 14)) +>a : Symbol(a, Decl(emptyObjectBindingPatternParameter03.ts, 1, 14)) var x, y, z; ->x : Symbol(x, Decl(emptyObjectBindingPatternParameter03.ts, 3, 7)) ->y : Symbol(y, Decl(emptyObjectBindingPatternParameter03.ts, 3, 10)) ->z : Symbol(z, Decl(emptyObjectBindingPatternParameter03.ts, 3, 13)) +>x : Symbol(x, Decl(emptyObjectBindingPatternParameter03.ts, 2, 7)) +>y : Symbol(y, Decl(emptyObjectBindingPatternParameter03.ts, 2, 10)) +>z : Symbol(z, Decl(emptyObjectBindingPatternParameter03.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter03.types b/tests/baselines/reference/emptyObjectBindingPatternParameter03.types index 873c748dd9b..0f89702402a 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter03.types +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter03.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter03.ts === - function f({}, a) { >f : ({}: {}, a: any) => void >a : any diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.js b/tests/baselines/reference/emptyObjectBindingPatternParameter04.js index fc3e41d0709..8c128bb806e 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter04.js +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter04.js @@ -1,6 +1,5 @@ //// [emptyObjectBindingPatternParameter04.ts] - function f({} = {a: 1, b: "2", c: true}) { var x, y, z; } @@ -10,3 +9,11 @@ function f(_a) { var _a = { a: 1, b: "2", c: true }; var x, y, z; } + + +//// [emptyObjectBindingPatternParameter04.d.ts] +declare function f({}?: { + a: number; + b: string; + c: boolean; +}): void; diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols b/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols index 9922d4cd074..1b594d9e38a 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter04.symbols @@ -1,14 +1,13 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts === - function f({} = {a: 1, b: "2", c: true}) { >f : Symbol(f, Decl(emptyObjectBindingPatternParameter04.ts, 0, 0)) ->a : Symbol(a, Decl(emptyObjectBindingPatternParameter04.ts, 2, 17)) ->b : Symbol(b, Decl(emptyObjectBindingPatternParameter04.ts, 2, 22)) ->c : Symbol(c, Decl(emptyObjectBindingPatternParameter04.ts, 2, 30)) +>a : Symbol(a, Decl(emptyObjectBindingPatternParameter04.ts, 1, 17)) +>b : Symbol(b, Decl(emptyObjectBindingPatternParameter04.ts, 1, 22)) +>c : Symbol(c, Decl(emptyObjectBindingPatternParameter04.ts, 1, 30)) var x, y, z; ->x : Symbol(x, Decl(emptyObjectBindingPatternParameter04.ts, 3, 7)) ->y : Symbol(y, Decl(emptyObjectBindingPatternParameter04.ts, 3, 10)) ->z : Symbol(z, Decl(emptyObjectBindingPatternParameter04.ts, 3, 13)) +>x : Symbol(x, Decl(emptyObjectBindingPatternParameter04.ts, 2, 7)) +>y : Symbol(y, Decl(emptyObjectBindingPatternParameter04.ts, 2, 10)) +>z : Symbol(z, Decl(emptyObjectBindingPatternParameter04.ts, 2, 13)) } diff --git a/tests/baselines/reference/emptyObjectBindingPatternParameter04.types b/tests/baselines/reference/emptyObjectBindingPatternParameter04.types index 5ee32d422a9..fddc23e854a 100644 --- a/tests/baselines/reference/emptyObjectBindingPatternParameter04.types +++ b/tests/baselines/reference/emptyObjectBindingPatternParameter04.types @@ -1,6 +1,5 @@ === tests/cases/conformance/es6/destructuring/emptyObjectBindingPatternParameter04.ts === - function f({} = {a: 1, b: "2", c: true}) { >f : ({}?: { a: number; b: string; c: boolean; }) => void >{a: 1, b: "2", c: true} : { a: number; b: string; c: boolean; } From e3657bccff7726777fc230f0a58116fe65bab465 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 1 Sep 2015 17:36:20 -0700 Subject: [PATCH 08/75] Added tests. --- ...mptyVariableDeclarationBindingPatterns01_ES5.ts | 14 ++++++++++++++ ...mptyVariableDeclarationBindingPatterns01_ES6.ts | 14 ++++++++++++++ ...mptyVariableDeclarationBindingPatterns02_ES5.ts | 12 ++++++++++++ ...mptyVariableDeclarationBindingPatterns02_ES6.ts | 12 ++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts create mode 100644 tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts create mode 100644 tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts create mode 100644 tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts new file mode 100644 index 00000000000..50beb289f60 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +// @declaration: true + +(function () { + var a: any; + + var {} = a; + let {} = a; + const {} = a; + + var [] = a; + let [] = a; + const [] = a; +})(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts new file mode 100644 index 00000000000..8fd5beef63b --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts @@ -0,0 +1,14 @@ +// @target: es6 +// @declaration: true + +(function () { + var a: any; + + var {} = a; + let {} = a; + const {} = a; + + var [] = a; + let [] = a; + const [] = a; +})(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts new file mode 100644 index 00000000000..34c05e1838f --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +// @declaration: true + +(function () { + var {}; + let {}; + const {}; + + var []; + let []; + const []; +})(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts new file mode 100644 index 00000000000..3146fec4cb7 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts @@ -0,0 +1,12 @@ +// @target: es6 +// @declaration: true + +(function () { + var {}; + let {}; + const {}; + + var []; + let []; + const []; +})(); \ No newline at end of file From 906634f0a48e5842d633a9e07178269e47a91bbc Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 1 Sep 2015 17:45:47 -0700 Subject: [PATCH 09/75] Accepted baselines. --- ...ariableDeclarationBindingPatterns01_ES5.js | 27 ++++++++++++++++ ...leDeclarationBindingPatterns01_ES5.symbols | 25 +++++++++++++++ ...ableDeclarationBindingPatterns01_ES5.types | 29 +++++++++++++++++ ...ariableDeclarationBindingPatterns01_ES6.js | 27 ++++++++++++++++ ...leDeclarationBindingPatterns01_ES6.symbols | 25 +++++++++++++++ ...ableDeclarationBindingPatterns01_ES6.types | 29 +++++++++++++++++ ...eclarationBindingPatterns02_ES5.errors.txt | 31 +++++++++++++++++++ ...ariableDeclarationBindingPatterns02_ES5.js | 24 ++++++++++++++ ...eclarationBindingPatterns02_ES6.errors.txt | 31 +++++++++++++++++++ ...ariableDeclarationBindingPatterns02_ES6.js | 24 ++++++++++++++ 10 files changed, 272 insertions(+) create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.errors.txt create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.js create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.errors.txt create mode 100644 tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.js diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js new file mode 100644 index 00000000000..2b50bc58dd7 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js @@ -0,0 +1,27 @@ +//// [emptyVariableDeclarationBindingPatterns01_ES5.ts] + +(function () { + var a: any; + + var {} = a; + let {} = a; + const {} = a; + + var [] = a; + let [] = a; + const [] = a; +})(); + +//// [emptyVariableDeclarationBindingPatterns01_ES5.js] +(function () { + var a; + var ; + var ; + var ; + var ; + var ; + var ; +})(); + + +//// [emptyVariableDeclarationBindingPatterns01_ES5.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols new file mode 100644 index 00000000000..eac59730e49 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts === + +(function () { + var a: any; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + var {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + let {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + const {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + var [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + let [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + const [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types new file mode 100644 index 00000000000..9508ef00a54 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts === + +(function () { +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;} : () => void + + var a: any; +>a : any + + var {} = a; +>a : any + + let {} = a; +>a : any + + const {} = a; +>a : any + + var [] = a; +>a : any + + let [] = a; +>a : any + + const [] = a; +>a : any + +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js new file mode 100644 index 00000000000..ba08ad93c3c --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js @@ -0,0 +1,27 @@ +//// [emptyVariableDeclarationBindingPatterns01_ES6.ts] + +(function () { + var a: any; + + var {} = a; + let {} = a; + const {} = a; + + var [] = a; + let [] = a; + const [] = a; +})(); + +//// [emptyVariableDeclarationBindingPatterns01_ES6.js] +(function () { + var a; + var { } = a; + let { } = a; + const { } = a; + var [] = a; + let [] = a; + const [] = a; +})(); + + +//// [emptyVariableDeclarationBindingPatterns01_ES6.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols new file mode 100644 index 00000000000..9a8130c87ca --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts === + +(function () { + var a: any; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + var {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + let {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + const {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + var [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + let [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + const [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types new file mode 100644 index 00000000000..09c04100695 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts === + +(function () { +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;} : () => void + + var a: any; +>a : any + + var {} = a; +>a : any + + let {} = a; +>a : any + + const {} = a; +>a : any + + var [] = a; +>a : any + + let [] = a; +>a : any + + const [] = a; +>a : any + +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.errors.txt b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.errors.txt new file mode 100644 index 00000000000..b589b075ecb --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(3,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(4,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(5,11): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(7,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(8,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts(9,11): error TS1182: A destructuring declaration must have an initializer. + + +==== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5.ts (6 errors) ==== + + (function () { + var {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + + var []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + })(); \ No newline at end of file diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.js new file mode 100644 index 00000000000..7710b5e26c1 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5.js @@ -0,0 +1,24 @@ +//// [emptyVariableDeclarationBindingPatterns02_ES5.ts] + +(function () { + var {}; + let {}; + const {}; + + var []; + let []; + const []; +})(); + +//// [emptyVariableDeclarationBindingPatterns02_ES5.js] +(function () { + var _a = void 0; + var _b = void 0; + var _c = void 0; + var _d = void 0; + var _e = void 0; + var _f = void 0; +})(); + + +//// [emptyVariableDeclarationBindingPatterns02_ES5.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.errors.txt b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.errors.txt new file mode 100644 index 00000000000..81349584f47 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(3,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(4,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(5,11): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(7,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(8,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts(9,11): error TS1182: A destructuring declaration must have an initializer. + + +==== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES6.ts (6 errors) ==== + + (function () { + var {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + + var []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + })(); \ No newline at end of file diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.js new file mode 100644 index 00000000000..8b2df68ed70 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES6.js @@ -0,0 +1,24 @@ +//// [emptyVariableDeclarationBindingPatterns02_ES6.ts] + +(function () { + var {}; + let {}; + const {}; + + var []; + let []; + const []; +})(); + +//// [emptyVariableDeclarationBindingPatterns02_ES6.js] +(function () { + var { }; + let { }; + const { }; + var []; + let []; + const []; +})(); + + +//// [emptyVariableDeclarationBindingPatterns02_ES6.d.ts] From a579d41a57b4b2edcfa92371d41ed2da7fa80e77 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 3 Sep 2015 13:53:00 -0700 Subject: [PATCH 10/75] Do not add symbol if it is undefined --- src/compiler/checker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a7e9561c57f..01403c70de7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14166,7 +14166,10 @@ namespace ts { let symbols: Symbol[] = []; let name = symbol.name; forEach(getSymbolLinks(symbol).containingType.types, t => { - symbols.push(getPropertyOfType(t, name)); + let symbol = getPropertyOfType(t, name); + if (symbol) { + symbols.push(symbol); + } }); return symbols; } From 568e4a56014f8e0c5a06e436c37da5c7e153369a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 2 Sep 2015 18:33:45 -0700 Subject: [PATCH 11/75] sample --- ...genericTypeAliasIntersectionCompletions.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts diff --git a/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts b/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts new file mode 100644 index 00000000000..7c0fa3e5b17 --- /dev/null +++ b/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts @@ -0,0 +1,32 @@ +/// + +//// type MixinCtor = new () => A & B & { constructor: MixinCtor }; +//// function merge(a: { prototype: A }, b: { prototype: B }): MixinCtor { +//// let merged = function() { } +//// Object.assign(merged.prototype, a.prototype, b.prototype); +//// return >merged; +//// } +//// +//// class TreeNode { +//// value: any; +//// } +//// +//// abstract class LeftSideNode extends TreeNode { +//// abstract right(): TreeNode; +//// left(): TreeNode { +//// return null; +//// } +//// } +//// +//// abstract class RightSideNode extends TreeNode { +//// abstract left(): TreeNode; +//// right(): TreeNode { +//// return null; +//// }; +//// } +//// +//// var obj = new (merge(LeftSideNode, RightSideNode))(); +//// obj./**/ + +goTo.marker(); +verify.completionListItemsCountIsGreaterThan(0); From 7a0c28ccc84184763476e9d92915b7dff9de0a6b Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 3 Sep 2015 14:11:54 -0700 Subject: [PATCH 12/75] make the test more specific --- .../cases/fourslash/genericTypeAliasIntersectionCompletions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts b/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts index 7c0fa3e5b17..0b2646291da 100644 --- a/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts +++ b/tests/cases/fourslash/genericTypeAliasIntersectionCompletions.ts @@ -29,4 +29,5 @@ //// obj./**/ goTo.marker(); -verify.completionListItemsCountIsGreaterThan(0); +verify.completionListContains("left"); +verify.completionListContains("right"); From 3518ad1723625a4dcf6df0faea6f7a2585038337 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 4 Sep 2015 12:14:57 -0700 Subject: [PATCH 13/75] Added more test cases. --- ...ariableDeclarationBindingPatterns01_ES5.ts | 34 ++++++++++++++++++- ...ariableDeclarationBindingPatterns01_ES6.ts | 34 ++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts index 50beb289f60..dec00737658 100644 --- a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts @@ -1,5 +1,4 @@ // @target: es5 -// @declaration: true (function () { var a: any; @@ -11,4 +10,37 @@ var [] = a; let [] = a; const [] = a; + + var {} = a, [] = a; + let {} = a, [] = a; + const {} = a, [] = a; + + var { p1: {}, p2: [] } = a; + let { p1: {}, p2: [] } = a; + const { p1: {}, p2: [] } = a; + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; + + for (var {} of ns) { + } + + for (let {} of ns) { + } + + for (const {} of ns) { + } + + for (var [] of ns) { + } + + for (let [] of ns) { + } + + for (const [] of ns) { + } })(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts index 8fd5beef63b..9f90dc28998 100644 --- a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts @@ -1,5 +1,4 @@ // @target: es6 -// @declaration: true (function () { var a: any; @@ -11,4 +10,37 @@ var [] = a; let [] = a; const [] = a; + + var {} = a, [] = a; + let {} = a, [] = a; + const {} = a, [] = a; + + var { p1: {}, p2: [] } = a; + let { p1: {}, p2: [] } = a; + const { p1: {}, p2: [] } = a; + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; + + for (var {} of ns) { + } + + for (let {} of ns) { + } + + for (const {} of ns) { + } + + for (var [] of ns) { + } + + for (let [] of ns) { + } + + for (const [] of ns) { + } })(); \ No newline at end of file From 9ba2fdaf68427574ad39b2a11f7e1b164418c0e4 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 4 Sep 2015 12:31:54 -0700 Subject: [PATCH 14/75] Accepted baselines. --- ...ariableDeclarationBindingPatterns01_ES5.js | 65 +++++++++++++++- ...leDeclarationBindingPatterns01_ES5.symbols | 52 +++++++++++++ ...ableDeclarationBindingPatterns01_ES5.types | 74 ++++++++++++++++++- ...ariableDeclarationBindingPatterns01_ES6.js | 59 ++++++++++++++- ...leDeclarationBindingPatterns01_ES6.symbols | 52 +++++++++++++ ...ableDeclarationBindingPatterns01_ES6.types | 74 ++++++++++++++++++- 6 files changed, 364 insertions(+), 12 deletions(-) diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js index 2b50bc58dd7..2c8d1c2f44f 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js @@ -10,6 +10,39 @@ var [] = a; let [] = a; const [] = a; + + var {} = a, [] = a; + let {} = a, [] = a; + const {} = a, [] = a; + + var { p1: {}, p2: [] } = a; + let { p1: {}, p2: [] } = a; + const { p1: {}, p2: [] } = a; + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; + + for (var {} of ns) { + } + + for (let {} of ns) { + } + + for (const {} of ns) { + } + + for (var [] of ns) { + } + + for (let [] of ns) { + } + + for (const [] of ns) { + } })(); //// [emptyVariableDeclarationBindingPatterns01_ES5.js] @@ -21,7 +54,33 @@ var ; var ; var ; + var , ; + var , ; + var , ; + var _a = a.p1, _b = a.p2; + var _c = a.p1, _d = a.p2; + var _e = a.p1, _f = a.p2; + for (var _g = {}, _h = {}; false; void 0) { + } +})(); +(function () { + var ns = []; + for (var _i = 0; _i < ns.length; _i++) { + var _a = ns[_i]; + } + for (var _b = 0; _b < ns.length; _b++) { + var _c = ns[_b]; + } + for (var _d = 0; _d < ns.length; _d++) { + var _e = ns[_d]; + } + for (var _f = 0; _f < ns.length; _f++) { + var _g = ns[_f]; + } + for (var _h = 0; _h < ns.length; _h++) { + var _j = ns[_h]; + } + for (var _k = 0; _k < ns.length; _k++) { + var _l = ns[_k]; + } })(); - - -//// [emptyVariableDeclarationBindingPatterns01_ES5.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols index eac59730e49..f8cc7d2546f 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols @@ -22,4 +22,56 @@ const [] = a; >a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + var {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + let {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + const {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + var { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + let { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + const { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + + for (var {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } + + for (let {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } + + for (const {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } + + for (var [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } + + for (let [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } + + for (const [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) + } })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types index 9508ef00a54..b4e3da1454b 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts === (function () { ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;})() : void ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;}) : () => void ->function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;} : () => void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }} : () => void var a: any; >a : any @@ -26,4 +26,72 @@ const [] = a; >a : any + var {} = a, [] = a; +>a : any +>a : any + + let {} = a, [] = a; +>a : any +>a : any + + const {} = a, [] = a; +>a : any +>a : any + + var { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + let { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + const { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + for (var {} = {}, {} = {}; false; void 0) { +>{} : {} +>{} : {} +>false : boolean +>void 0 : undefined +>0 : number + } +})(); + +(function () { +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }})() : void +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }}) : () => void +>function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }} : () => void + + const ns: number[][] = []; +>ns : number[][] +>[] : undefined[] + + for (var {} of ns) { +>ns : number[][] + } + + for (let {} of ns) { +>ns : number[][] + } + + for (const {} of ns) { +>ns : number[][] + } + + for (var [] of ns) { +>ns : number[][] + } + + for (let [] of ns) { +>ns : number[][] + } + + for (const [] of ns) { +>ns : number[][] + } })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js index ba08ad93c3c..924303c1976 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js @@ -10,6 +10,39 @@ var [] = a; let [] = a; const [] = a; + + var {} = a, [] = a; + let {} = a, [] = a; + const {} = a, [] = a; + + var { p1: {}, p2: [] } = a; + let { p1: {}, p2: [] } = a; + const { p1: {}, p2: [] } = a; + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; + + for (var {} of ns) { + } + + for (let {} of ns) { + } + + for (const {} of ns) { + } + + for (var [] of ns) { + } + + for (let [] of ns) { + } + + for (const [] of ns) { + } })(); //// [emptyVariableDeclarationBindingPatterns01_ES6.js] @@ -21,7 +54,27 @@ var [] = a; let [] = a; const [] = a; + var { } = a, [] = a; + let { } = a, [] = a; + const { } = a, [] = a; + var { p1: { }, p2: [] } = a; + let { p1: { }, p2: [] } = a; + const { p1: { }, p2: [] } = a; + for (var { } = {}, { } = {}; false; void 0) { + } +})(); +(function () { + const ns = []; + for (var { } of ns) { + } + for (let { } of ns) { + } + for (const { } of ns) { + } + for (var [] of ns) { + } + for (let [] of ns) { + } + for (const [] of ns) { + } })(); - - -//// [emptyVariableDeclarationBindingPatterns01_ES6.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols index 9a8130c87ca..d158e3a4891 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols @@ -22,4 +22,56 @@ const [] = a; >a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + var {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + let {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + const {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + var { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + let { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + const { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + for (var {} = {}, {} = {}; false; void 0) { + } +})(); + +(function () { + const ns: number[][] = []; +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + + for (var {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } + + for (let {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } + + for (const {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } + + for (var [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } + + for (let [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } + + for (const [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) + } })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types index 09c04100695..e8dd5025288 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts === (function () { ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;})() : void ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;}) : () => void ->function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a;} : () => void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }} : () => void var a: any; >a : any @@ -26,4 +26,72 @@ const [] = a; >a : any + var {} = a, [] = a; +>a : any +>a : any + + let {} = a, [] = a; +>a : any +>a : any + + const {} = a, [] = a; +>a : any +>a : any + + var { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + let { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + const { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + for (var {} = {}, {} = {}; false; void 0) { +>{} : {} +>{} : {} +>false : boolean +>void 0 : undefined +>0 : number + } +})(); + +(function () { +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }})() : void +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }}) : () => void +>function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }} : () => void + + const ns: number[][] = []; +>ns : number[][] +>[] : undefined[] + + for (var {} of ns) { +>ns : number[][] + } + + for (let {} of ns) { +>ns : number[][] + } + + for (const {} of ns) { +>ns : number[][] + } + + for (var [] of ns) { +>ns : number[][] + } + + for (let [] of ns) { +>ns : number[][] + } + + for (const [] of ns) { +>ns : number[][] + } })(); From 97b846c444843c3c2c1bdad332c7d0407fcea5df Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 4 Sep 2015 10:53:33 -0700 Subject: [PATCH 15/75] handle jsx identifiers correctly, indent content of JsxSelfClosingElement --- src/services/formatting/formattingScanner.ts | 25 ++++++- src/services/formatting/smartIndenter.ts | 1 + .../cases/fourslash/formattingJsxElements.ts | 70 ++++++++++++++++++- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 7e77878051c..6f6167d6ba9 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -17,7 +17,8 @@ namespace ts.formatting { Scan, RescanGreaterThanToken, RescanSlashToken, - RescanTemplateToken + RescanTemplateToken, + RescanJsxIdentifier } export function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner { @@ -108,6 +109,20 @@ namespace ts.formatting { return false; } + + function shouldRescanJsxIdentifier(node: Node): boolean { + if (node.parent) { + switch(node.parent.kind) { + case SyntaxKind.JsxAttribute: + case SyntaxKind.JsxOpeningElement: + case SyntaxKind.JsxClosingElement: + case SyntaxKind.JsxSelfClosingElement: + return node.kind === SyntaxKind.Identifier; + } + } + + return false; + } function shouldRescanSlashToken(container: Node): boolean { return container.kind === SyntaxKind.RegularExpressionLiteral; @@ -141,7 +156,9 @@ namespace ts.formatting { ? ScanAction.RescanSlashToken : shouldRescanTemplateToken(n) ? ScanAction.RescanTemplateToken - : ScanAction.Scan + : shouldRescanJsxIdentifier(n) + ? ScanAction.RescanJsxIdentifier + : ScanAction.Scan if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. @@ -176,6 +193,10 @@ namespace ts.formatting { currentToken = scanner.reScanTemplateToken(); lastScanAction = ScanAction.RescanTemplateToken; } + else if (expectedScanAction === ScanAction.RescanJsxIdentifier && currentToken === SyntaxKind.Identifier) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = ScanAction.RescanJsxIdentifier; + } else { lastScanAction = ScanAction.Scan; } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 9c19e32ab6f..8355fac03f5 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -431,6 +431,7 @@ namespace ts.formatting { case SyntaxKind.ArrayBindingPattern: case SyntaxKind.ObjectBindingPattern: case SyntaxKind.JsxElement: + case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.MethodSignature: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: diff --git a/tests/cases/fourslash/formattingJsxElements.ts b/tests/cases/fourslash/formattingJsxElements.ts index d0c77804ed5..fd4ccc504a4 100644 --- a/tests/cases/fourslash/formattingJsxElements.ts +++ b/tests/cases/fourslash/formattingJsxElements.ts @@ -1,7 +1,7 @@ /// //@Filename: file.tsx -////function () { +////function foo0() { //// return ( ////
////Hello, World!/*autoformat*/ @@ -10,10 +10,76 @@ //// ) ////} //// +////function foo1() { +//// return ( +////
+////Hello, World!/*autoformat1*/ +/////*indent1*/ +////
+//// ) +////} +//// +////function foo2() { +//// return ( +////
/*2*/ +////Hello, World!/*autoformat2*/ +/////*indent2*/ +////
+//// ) +////} +////function foo3() { +//// return ( +//// /*4*/ +//// Hello, World!/*autoformat3*/ +//// /*indent3*/ +//// +//// ) +////} +////function foo4() { +//// return ( +//// /*6*/ +//// ) +////} format.document(); goTo.marker("autoformat"); verify.currentLineContentIs(' Hello, World!'); goTo.marker("indent"); -verify.indentationIs(12); \ No newline at end of file +verify.indentationIs(12); + +goTo.marker("autoformat1"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent1"); +verify.indentationIs(12); + +goTo.marker("1"); +verify.currentLineContentIs(' class1= {'); +goTo.marker("2"); +verify.currentLineContentIs(' }>'); + +goTo.marker("autoformat2"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent2"); +verify.indentationIs(12); + +goTo.marker("3"); +verify.currentLineContentIs(' class2= {'); +goTo.marker("4"); +verify.currentLineContentIs(' }>'); + +goTo.marker("autoformat3"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent3"); +verify.indentationIs(12); + +goTo.marker("5"); +verify.currentLineContentIs(' class3= {'); +goTo.marker("6"); +verify.currentLineContentIs(' }/>'); From 5297a7f319d1c76b07f995418e25600eda974a9a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 4 Sep 2015 17:53:56 -0700 Subject: [PATCH 16/75] Ensure that zero-element binding patterns don't try to reuse assigned identifiers. --- src/compiler/emitter.ts | 59 ++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index eeaab6d2123..485181a91cc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3210,22 +3210,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function ensureIdentifier(expr: Expression): Expression { - if (expr.kind !== SyntaxKind.Identifier) { - let identifier = createTempVariable(TempFlags.Auto); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - expr = identifier; + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * This function is useful to ensure that the expression's value can be read from in subsequent expressions. + * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. + * + * @param expr the expression whose value needs to be bound. + * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; + * false if it is necessary to always emit an identifier. + */ + function ensureIdentifier(expr: Expression, reuseIdentifierExpressions: boolean): Expression { + if (expr.kind === SyntaxKind.Identifier && reuseIdentifierExpressions) { + return expr; } - return expr; + + let identifier = createTempVariable(TempFlags.Auto); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + return identifier; } function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); // Return the expression 'value === void 0 ? defaultValue : value' let equals = createSynthesizedNode(SyntaxKind.BinaryExpression); equals.left = value; @@ -3276,7 +3286,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { @@ -3291,7 +3301,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (let i = 0; i < elements.length; i++) { let e = elements[i]; @@ -3336,7 +3346,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) { write("("); } - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); emitDestructuringAssignment(target, value); write(", "); emit(value); @@ -3346,7 +3356,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function emitBindingElement(target: BindingElement, value: Expression) { + function emitBindingElement(target: BindingElement | VariableDeclaration, value: Expression) { if (target.initializer) { // Combine value and initializer value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; @@ -3356,14 +3366,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi value = createVoidZero(); } if (isBindingPattern(target.name)) { - let pattern = target.name; - let elements = pattern.elements; - if (elements.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + const pattern = target.name; + const elements = pattern.elements; + const numElements = elements.length; + + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); } - for (let i = 0; i < elements.length; i++) { + + for (let i = 0; i < numElements; i++) { let element = elements[i]; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { // Rewrite element to a declaration with an initializer that fetches property @@ -3375,7 +3390,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } - else if (i === elements.length - 1) { + else if (i === numElements - 1) { emitBindingElement(element, createSliceCall(value, i)); } } From 8952ed66b2e3ba78d64e8399384dd55ecfccabd8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 4 Sep 2015 17:57:06 -0700 Subject: [PATCH 17/75] Accepted baselines. --- ...ariableDeclarationBindingPatterns01_ES5.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js index 2c8d1c2f44f..9ce2a04dad4 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js @@ -48,19 +48,19 @@ //// [emptyVariableDeclarationBindingPatterns01_ES5.js] (function () { var a; - var ; - var ; - var ; - var ; - var ; - var ; - var , ; - var , ; - var , ; - var _a = a.p1, _b = a.p2; - var _c = a.p1, _d = a.p2; - var _e = a.p1, _f = a.p2; - for (var _g = {}, _h = {}; false; void 0) { + var _a = a; + var _b = a; + var _c = a; + var _d = a; + var _e = a; + var _f = a; + var _g = a, _h = a; + var _j = a, _k = a; + var _l = a, _m = a; + var _o = a.p1, _p = a.p2; + var _q = a.p1, _r = a.p2; + var _s = a.p1, _t = a.p2; + for (var _u = {}, _v = {}; false; void 0) { } })(); (function () { From 8a38a1e4b9d67181d91b21f1ffc1879e42106b72 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 8 Sep 2015 12:26:29 -0700 Subject: [PATCH 18/75] Change typescript.d.ts to be an external module instead of an ambient external module declaration --- Jakefile.js | 15 ++++++++++++--- lib/typescript.d.ts | 18 ++++++++++-------- tests/cases/compiler/APISample_compile.ts | 2 +- tests/cases/compiler/APISample_linter.ts | 2 +- tests/cases/compiler/APISample_transform.ts | 2 +- tests/cases/compiler/APISample_watcher.ts | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index ea13cce6685..96c2b44c088 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -394,6 +394,7 @@ var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); +var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts"); compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ [copyright], @@ -410,11 +411,19 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca prependFile(copyright, standaloneDefinitionsFile); - // Create the node definition file by replacing 'ts' module with '"typescript"' as a module. + // Stanalone/web definition file using global 'ts' namespace jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true}); var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString(); - definitionFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"'); - fs.writeFileSync(nodeDefinitionsFile, definitionFileContents); + + // Official node package definition file, pointed to by 'typings' in package.json + // Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module + var nodeDefinitionsFileContents = definitionFileContents + "\r\nexport = ts;"; + fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents); + + // Node package definition file to be distributed without the package. Created by replacing + // 'ts' namespace with '"typescript"' as a module. + var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"'); + fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents); }); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index bf0510cf1c8..5e6492cfe1e 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -13,7 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -declare module "typescript" { +declare namespace ts { interface Map { [index: string]: T; } @@ -1405,7 +1405,7 @@ declare module "typescript" { newLength: number; } } -declare module "typescript" { +declare namespace ts { interface System { args: string[]; newLine: string; @@ -1429,7 +1429,7 @@ declare module "typescript" { } var sys: System; } -declare module "typescript" { +declare namespace ts { interface ErrorCallback { (message: DiagnosticMessage, length: number): void; } @@ -1474,7 +1474,7 @@ declare module "typescript" { function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } -declare module "typescript" { +declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; function textSpanEnd(span: TextSpan): number; function textSpanIsEmpty(span: TextSpan): boolean; @@ -1504,14 +1504,14 @@ declare module "typescript" { function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; } -declare module "typescript" { +declare namespace ts { function getNodeConstructor(kind: SyntaxKind): new () => Node; function createNode(kind: SyntaxKind): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } -declare module "typescript" { +declare namespace ts { const version: string; function findConfigFile(searchPath: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; @@ -1524,7 +1524,7 @@ declare module "typescript" { function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } -declare module "typescript" { +declare namespace ts { function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file @@ -1551,7 +1551,7 @@ declare module "typescript" { */ function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine; } -declare module "typescript" { +declare namespace ts { /** The version of the language service API */ let servicesVersion: string; interface Node { @@ -2139,3 +2139,5 @@ declare module "typescript" { */ function getDefaultLibFilePath(options: CompilerOptions): string; } + +export = ts; \ No newline at end of file diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index d3cc650dd2a..c63009f7d63 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @includebuiltfile: typescript.d.ts +// @includebuiltfile: typescript_standalone.d.ts // @stripInternal:true /* diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index 9f9b55a0a67..8cb6934cee3 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @includebuiltfile: typescript.d.ts +// @includebuiltfile: typescript_standalone.d.ts // @stripInternal:true /* diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index 48e27c4e008..88b9754536a 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @includebuiltfile: typescript.d.ts +// @includebuiltfile: typescript_standalone.d.ts // @stripInternal:true /* diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index b152f86c378..9afa53ddf14 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @includebuiltfile: typescript.d.ts +// @includebuiltfile: typescript_standalone.d.ts // @stripInternal:true /* From 5aa17cd671ff56bc9a97f62a76191d640196c17d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 9 Sep 2015 12:47:31 -0700 Subject: [PATCH 19/75] Added tests for parameter initializers. --- .../emptyVariableDeclarationBindingPatterns01_ES5.ts | 4 ++++ .../emptyVariableDeclarationBindingPatterns01_ES6.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts index dec00737658..bc7a729fd1e 100644 --- a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts @@ -21,6 +21,10 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { + return ({} = a, [] = a, { p: {} = a } = a) => a; + } })(); (function () { diff --git a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts index 9f90dc28998..9f2a9905480 100644 --- a/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts +++ b/tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts @@ -21,6 +21,10 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { + return ({} = a, [] = a, { p: {} = a } = a) => a; + } })(); (function () { From fb889bee4ee5b4cba2083b12ae878e4833bd2dfd Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 9 Sep 2015 13:05:39 -0700 Subject: [PATCH 20/75] Accepted baselines. --- ...ariableDeclarationBindingPatterns01_ES5.js | 15 ++++++++++ ...leDeclarationBindingPatterns01_ES5.symbols | 29 ++++++++++++++----- ...ableDeclarationBindingPatterns01_ES5.types | 24 +++++++++++++-- ...ariableDeclarationBindingPatterns01_ES6.js | 7 +++++ ...leDeclarationBindingPatterns01_ES6.symbols | 29 ++++++++++++++----- ...ableDeclarationBindingPatterns01_ES6.types | 24 +++++++++++++-- 6 files changed, 108 insertions(+), 20 deletions(-) diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js index 9ce2a04dad4..11c4f4e1807 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.js @@ -21,6 +21,10 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { + return ({} = a, [] = a, { p: {} = a } = a) => a; + } })(); (function () { @@ -62,6 +66,17 @@ var _s = a.p1, _t = a.p2; for (var _u = {}, _v = {}; false; void 0) { } + function f(_a, _b, _c) { + var _a = a; + var _b = a; + var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; + return function (_a, _b, _c) { + var _a = a; + var _b = a; + var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; + return a; + }; + } })(); (function () { var ns = []; diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols index f8cc7d2546f..ddba9738e08 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.symbols @@ -45,33 +45,48 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : Symbol(f, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 21, 5)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 2, 7)) + } })(); (function () { const ns: number[][] = []; ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) for (var {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } for (let {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } for (const {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } for (var [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } for (let [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } for (const [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5.ts, 29, 9)) } })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types index b4e3da1454b..ed6b935db0f 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5.ts === (function () { ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }})() : void ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }}) : () => void ->function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }} : () => void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }} : () => void var a: any; >a : any @@ -60,6 +60,24 @@ >void 0 : undefined >0 : number } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any +>a : any + } })(); (function () { diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js index 924303c1976..1303ab1e3d0 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.js @@ -21,6 +21,10 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { + return ({} = a, [] = a, { p: {} = a } = a) => a; + } })(); (function () { @@ -62,6 +66,9 @@ const { p1: { }, p2: [] } = a; for (var { } = {}, { } = {}; false; void 0) { } + function f({ } = a, [] = a, { p: { } = a } = a) { + return ({ } = a, [] = a, { p: { } = a } = a) => a; + } })(); (function () { const ns = []; diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols index d158e3a4891..6a826d4b6c9 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.symbols @@ -45,33 +45,48 @@ for (var {} = {}, {} = {}; false; void 0) { } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : Symbol(f, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 21, 5)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 2, 7)) + } })(); (function () { const ns: number[][] = []; ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) for (var {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } for (let {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } for (const {} of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } for (var [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } for (let [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } for (const [] of ns) { ->ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 25, 9)) +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES6.ts, 29, 9)) } })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types index e8dd5025288..fcb48048148 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES6.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES6.ts === (function () { ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }})() : void ->(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }}) : () => void ->function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { }} : () => void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }} : () => void var a: any; >a : any @@ -60,6 +60,24 @@ >void 0 : undefined >0 : number } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : ({}?: any, []?: any, { p: {} = a}?: any) => ({}?: any, []?: any, { p: {} = a }?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, { p: {} = a }?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any +>a : any + } })(); (function () { From ee56e60ca0772f292f604f85555a271dfc21095c Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 8 Sep 2015 18:40:30 -0700 Subject: [PATCH 21/75] do not emit '=' in jsx attribute if initializer is missing --- src/compiler/emitter.ts | 6 ++++-- .../reference/jsxEmitAttributeWithPreserve.js | 7 +++++++ .../reference/jsxEmitAttributeWithPreserve.symbols | 8 ++++++++ .../reference/jsxEmitAttributeWithPreserve.types | 10 ++++++++++ .../baselines/reference/jsxInvalidEsprimaTestSuite.js | 6 +++--- tests/baselines/reference/jsxReactTestSuite.js | 4 ++-- tests/baselines/reference/tsxAttributeResolution6.js | 6 +++--- .../reference/tsxGenericArrowFunctionParsing.js | 2 +- tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx | 4 ++++ 9 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/jsxEmitAttributeWithPreserve.js create mode 100644 tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols create mode 100644 tests/baselines/reference/jsxEmitAttributeWithPreserve.types create mode 100644 tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 54c308217da..2d5bda1bba2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1292,8 +1292,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) { function emitJsxAttribute(node: JsxAttribute) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node: JsxSpreadAttribute) { diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.js b/tests/baselines/reference/jsxEmitAttributeWithPreserve.js new file mode 100644 index 00000000000..07cb0dee485 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.js @@ -0,0 +1,7 @@ +//// [jsxEmitAttributeWithPreserve.tsx] + +declare var React: any; + + +//// [jsxEmitAttributeWithPreserve.jsx] +; diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols b/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols new file mode 100644 index 00000000000..4ffadb8e888 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx === + +declare var React: any; +>React : Symbol(React, Decl(jsxEmitAttributeWithPreserve.tsx, 1, 11)) + + +>data : Symbol(unknown) + diff --git a/tests/baselines/reference/jsxEmitAttributeWithPreserve.types b/tests/baselines/reference/jsxEmitAttributeWithPreserve.types new file mode 100644 index 00000000000..972ca1c3d88 --- /dev/null +++ b/tests/baselines/reference/jsxEmitAttributeWithPreserve.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx === + +declare var React: any; +>React : any + + +> : any +>foo : any +>data : any + diff --git a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js index daf344b08da..d623e127be7 100644 --- a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js +++ b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js @@ -47,9 +47,9 @@ a / > ; < a; b > ; b > ; -; +; b.c > ; -; +; c > ; ; < .a > ; @@ -67,7 +67,7 @@ var x =
one
two
;; var x =
one
/* intervening comment */ /* intervening comment */
two
;; {"str"}}; id="b" />; -
>; +
>;
;
stuff
...props}>; diff --git a/tests/baselines/reference/jsxReactTestSuite.js b/tests/baselines/reference/jsxReactTestSuite.js index 300274a1614..18013d4be9b 100644 --- a/tests/baselines/reference/jsxReactTestSuite.js +++ b/tests/baselines/reference/jsxReactTestSuite.js @@ -158,14 +158,14 @@ var x =
; ; ; -; +; ; ; ; ; ; ; -; +; ; ; Text; diff --git a/tests/baselines/reference/tsxAttributeResolution6.js b/tests/baselines/reference/tsxAttributeResolution6.js index f4af0ba875a..5d6ad1e20c6 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.js +++ b/tests/baselines/reference/tsxAttributeResolution6.js @@ -20,10 +20,10 @@ declare module JSX { //// [tsxAttributeResolution6.jsx] // Error -; +; ; ; // OK -; +; ; -; +; diff --git a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js index f493347ca9c..ece48831f8e 100644 --- a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js +++ b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js @@ -42,5 +42,5 @@ x3(); var x4 = () => ; x4.isElement; // This is an element -var x5 = () => ; +var x5 = () => ; x5.isElement; diff --git a/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx b/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx new file mode 100644 index 00000000000..dc32ef7a0ca --- /dev/null +++ b/tests/cases/compiler/jsxEmitAttributeWithPreserve.tsx @@ -0,0 +1,4 @@ +//@jsx: preserve + +declare var React: any; + \ No newline at end of file From 7e1739604a81b9f18ee43b96b1801e9cbfda10bb Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 10 Sep 2015 13:24:45 -0700 Subject: [PATCH 22/75] Fix #4727: prerocess `export import` declarations correctelly --- src/services/services.ts | 20 +++++++++++++++++++ .../unittests/services/preProcessFile.ts | 14 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/services/services.ts b/src/services/services.ts index b174f240875..58f59843078 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2152,6 +2152,7 @@ namespace ts { // // export * from "mod" // export {a as b} from "mod" + // export import i = require("mod") while (token !== SyntaxKind.EndOfFileToken) { if (token === SyntaxKind.DeclareKeyword) { @@ -2276,6 +2277,25 @@ namespace ts { } } } + else if (token === SyntaxKind.ImportKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.Identifier || isKeyword(token)) { + token = scanner.scan(); + if (token === SyntaxKind.EqualsToken) { + token = scanner.scan(); + if (token === SyntaxKind.RequireKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.OpenParenToken) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // export import i = require("mod"); + recordModuleName(); + } + } + } + } + } + } } token = scanner.scan(); } diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index 982c45f0f2d..7b645069212 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -173,6 +173,20 @@ describe('PreProcessFile:', function () { isLibFile: false }) }); + + it("Correctly handeles export import declarations", function () { + test("export import a = require(\"m1\");", + true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "m1", pos: 26, end: 28 } + ], + ambientExternalModules: undefined, + isLibFile: false + }) + }); + }); }); From fae7a129eb91e66d7a32bbfddfec1d0c24ce66dc Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 10 Sep 2015 13:50:12 -0700 Subject: [PATCH 23/75] Assert condition to track root cause of issue. --- src/compiler/commandLineParser.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index c56a18b3ab2..c9df1747999 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -326,9 +326,12 @@ namespace ts { if (hasProperty(map, key)) { options[opt.name] = map[key]; } - else { + else if (opt.error) { errors.push(createCompilerDiagnostic(opt.error)); } + else { + Debug.fail(`Command line option for '${opt.name}' doesn't account for invalid options.`); + } } } else { From c18051d5fff0ed5e2f0904a81b6eed28f7bc7368 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 10 Sep 2015 14:22:31 -0700 Subject: [PATCH 24/75] Update version to 1.6.2 --- package.json | 2 +- src/compiler/program.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index abd81e12f47..8ce9989b617 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.6.0", + "version": "1.6.2", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/program.ts b/src/compiler/program.ts index a1861f6b462..c239b18efb7 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -12,7 +12,7 @@ namespace ts { let emptyArray: any[] = []; - export const version = "1.6.0"; + export const version = "1.6.2"; export function findConfigFile(searchPath: string): string { let fileName = "tsconfig.json"; From 4b15c5f6281f6022eda2433382bbc19dc225b1cc Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 10 Sep 2015 14:23:33 -0700 Subject: [PATCH 25/75] Added error for bad argument, fixed diagnostic for '--help' message. --- src/compiler/commandLineParser.ts | 5 +++-- src/compiler/diagnosticInformationMap.generated.ts | 3 ++- src/compiler/diagnosticMessages.json | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index c9df1747999..93153e5fddb 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -243,8 +243,9 @@ namespace ts { "node": ModuleResolutionKind.NodeJs, "classic": ModuleResolutionKind.Classic }, - description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 - } + description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic, + } ]; /* @internal */ diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f7351bf6912..1c9232d1515 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -560,13 +560,14 @@ namespace ts { Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, + Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, + Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9fd08ef9bca..f6875c45c47 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2230,6 +2230,11 @@ "category": "Error", "code": 6062 }, + "Argument for '--moduleResolution' option must be 'node' or 'classic'.": { + "category": "Error", + "code": 6063 + }, + "Specify JSX code generation: 'preserve' or 'react'": { "category": "Message", "code": 6080 @@ -2254,7 +2259,7 @@ "category": "Message", "code": 6068 }, - "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .": { + "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": { "category": "Message", "code": 6069 }, From 535efd1b5de9cf86a6bf04a4a003f01c5c0d215b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 10 Sep 2015 14:23:56 -0700 Subject: [PATCH 26/75] Encode the conditional presence of 'error' in the type system. --- src/compiler/commandLineParser.ts | 7 ++----- src/compiler/types.ts | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 93153e5fddb..9b7558f315a 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -327,11 +327,8 @@ namespace ts { if (hasProperty(map, key)) { options[opt.name] = map[key]; } - else if (opt.error) { - errors.push(createCompilerDiagnostic(opt.error)); - } else { - Debug.fail(`Command line option for '${opt.name}' doesn't account for invalid options.`); + errors.push(createCompilerDiagnostic((opt).error)); } } } @@ -444,7 +441,7 @@ namespace ts { value = optType[key]; } else { - errors.push(createCompilerDiagnostic(opt.error)); + errors.push(createCompilerDiagnostic((opt).error)); value = 0; } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 47182e39527..f9d1b506274 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2112,17 +2112,30 @@ namespace ts { } /* @internal */ - export interface CommandLineOption { + interface CommandLineOptionBase { name: string; type: string | Map; // "string", "number", "boolean", or an object literal mapping named values to actual values isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter - error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type' experimental?: boolean; } + /* @internal */ + export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase { + type: string; // "string" | "number" | "boolean" + } + + /* @internal */ + export interface CommandLineOptionOfCustomType extends CommandLineOptionBase { + type: Map; // an object literal mapping named values to actual values + error: DiagnosticMessage; // The error given when the argument does not fit a customized 'type' + } + + /* @internal */ + export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType; + /* @internal */ export const enum CharacterCodes { nullCharacter = 0, From 50e122f90162d3715287268633536da5bfc0331f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 10 Sep 2015 15:19:59 -0700 Subject: [PATCH 27/75] Update LKG --- lib/lib.d.ts | 32 ++++- lib/lib.dom.d.ts | 32 ++++- lib/lib.es6.d.ts | 32 ++++- lib/lib.webworker.d.ts | 32 ++++- lib/tsc.js | 143 +++++++++++---------- lib/tsserver.js | 215 +++++++++++++++++++------------- lib/typescript.js | 252 ++++++++++++++++++++++++-------------- lib/typescriptServices.js | 252 ++++++++++++++++++++++++-------------- 8 files changed, 653 insertions(+), 337 deletions(-) diff --git a/lib/lib.d.ts b/lib/lib.d.ts index c55970d9aca..d25e29bddb4 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -3928,6 +3928,7 @@ declare module Intl { timeZoneName?: string; formatMatcher?: string; hour12?: boolean; + timeZone?: string; } interface ResolvedDateTimeFormatOptions { @@ -3997,18 +3998,45 @@ interface Number { interface Date { /** - * Converts a date to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 54461afef40..76e5f1b20a1 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -104,6 +104,7 @@ declare module Intl { timeZoneName?: string; formatMatcher?: string; hour12?: boolean; + timeZone?: string; } interface ResolvedDateTimeFormatOptions { @@ -173,18 +174,45 @@ interface Number { interface Date { /** - * Converts a date to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index de051a44edd..507f0da5004 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -5216,6 +5216,7 @@ declare module Intl { timeZoneName?: string; formatMatcher?: string; hour12?: boolean; + timeZone?: string; } interface ResolvedDateTimeFormatOptions { @@ -5285,18 +5286,45 @@ interface Number { interface Date { /** - * Converts a date to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 0f3e85da9f1..56e08ff6efc 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -104,6 +104,7 @@ declare module Intl { timeZoneName?: string; formatMatcher?: string; hour12?: boolean; + timeZone?: string; } interface ResolvedDateTimeFormatOptions { @@ -173,18 +174,45 @@ interface Number { interface Date { /** - * Converts a date to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + /** * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } diff --git a/lib/tsc.js b/lib/tsc.js index 591a22bceb9..019ef143cc8 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1564,13 +1564,14 @@ var ts; Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, + Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, + Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, @@ -14049,6 +14050,7 @@ var ts; var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } return true; @@ -20970,7 +20972,10 @@ var ts; var symbols = []; var name_15 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - symbols.push(getPropertyOfType(t, name_15)); + var symbol = getPropertyOfType(t, name_15); + if (symbol) { + symbols.push(symbol); + } }); return symbols; } @@ -24505,8 +24510,10 @@ var ts; function jsxEmitPreserve(node) { function emitJsxAttribute(node) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node) { write("{..."); @@ -26029,19 +26036,19 @@ var ts; write(")"); } } - function ensureIdentifier(expr) { - if (expr.kind !== 67) { - var identifier = createTempVariable(0); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - expr = identifier; + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 67 && reuseIdentifierExpressions) { + return expr; } - return expr; + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + return identifier; } function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); var equals = ts.createSynthesizedNode(179); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); @@ -26082,7 +26089,7 @@ var ts; function emitObjectLiteralAssignment(target, value) { var properties = target.properties; if (properties.length !== 1) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; @@ -26095,7 +26102,7 @@ var ts; function emitArrayLiteralAssignment(target, value) { var elements = target.elements; if (elements.length !== 1) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; @@ -26137,7 +26144,7 @@ var ts; if (root.parent.kind !== 170) { write("("); } - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); emitDestructuringAssignment(target, value); write(", "); emit(value); @@ -26156,10 +26163,11 @@ var ts; if (ts.isBindingPattern(target.name)) { var pattern = target.name; var elements = pattern.elements; - if (elements.length !== 1) { - value = ensureIdentifier(value); + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0); } - for (var i = 0; i < elements.length; i++) { + for (var i = 0; i < numElements; i++) { var element = elements[i]; if (pattern.kind === 159) { var propName = element.propertyName || element.name; @@ -26169,7 +26177,7 @@ var ts; if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } - else if (i === elements.length - 1) { + else if (i === numElements - 1) { emitBindingElement(element, createSliceCall(value, i)); } } @@ -27289,50 +27297,49 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { - if (!node) { - return; - } - switch (node.kind) { - case 101: - write("void 0"); - return; - case 158: - emitSerializedTypeNode(node.type); - return; - case 150: - case 151: - write("Function"); - return; - case 154: - case 155: - write("Array"); - return; - case 148: - case 118: - write("Boolean"); - return; - case 128: - case 9: - write("String"); - return; - case 126: - write("Number"); - return; - case 129: - write("Symbol"); - return; - case 149: - emitSerializedTypeReferenceNode(node); - return; - case 152: - case 153: - case 156: - case 157: - case 115: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; + if (node) { + switch (node.kind) { + case 101: + write("void 0"); + return; + case 158: + emitSerializedTypeNode(node.type); + return; + case 150: + case 151: + write("Function"); + return; + case 154: + case 155: + write("Array"); + return; + case 148: + case 118: + write("Boolean"); + return; + case 128: + case 9: + write("String"); + return; + case 126: + write("Number"); + return; + case 129: + write("Symbol"); + return; + case 149: + emitSerializedTypeReferenceNode(node); + return; + case 152: + case 153: + case 156: + case 157: + case 115: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } } write("Object"); } @@ -29332,7 +29339,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.6.0"; + ts.version = "1.6.2"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -30397,8 +30404,8 @@ var ts; "node": 2, "classic": 1 }, - experimental: true, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 + description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic } ]; var optionNameMapCache; diff --git a/lib/tsserver.js b/lib/tsserver.js index 78836160678..fc5f34dec2a 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -1564,13 +1564,14 @@ var ts; Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, + Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, + Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, @@ -3223,8 +3224,8 @@ var ts; "node": 2, "classic": 1 }, - experimental: true, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 + description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic } ]; var optionNameMapCache; @@ -14511,6 +14512,7 @@ var ts; var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } return true; @@ -21432,7 +21434,10 @@ var ts; var symbols = []; var name_16 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - symbols.push(getPropertyOfType(t, name_16)); + var symbol = getPropertyOfType(t, name_16); + if (symbol) { + symbols.push(symbol); + } }); return symbols; } @@ -24967,8 +24972,10 @@ var ts; function jsxEmitPreserve(node) { function emitJsxAttribute(node) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node) { write("{..."); @@ -26491,19 +26498,19 @@ var ts; write(")"); } } - function ensureIdentifier(expr) { - if (expr.kind !== 67) { - var identifier = createTempVariable(0); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - expr = identifier; + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 67 && reuseIdentifierExpressions) { + return expr; } - return expr; + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + return identifier; } function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); var equals = ts.createSynthesizedNode(179); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); @@ -26544,7 +26551,7 @@ var ts; function emitObjectLiteralAssignment(target, value) { var properties = target.properties; if (properties.length !== 1) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; @@ -26557,7 +26564,7 @@ var ts; function emitArrayLiteralAssignment(target, value) { var elements = target.elements; if (elements.length !== 1) { - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; @@ -26599,7 +26606,7 @@ var ts; if (root.parent.kind !== 170) { write("("); } - value = ensureIdentifier(value); + value = ensureIdentifier(value, true); emitDestructuringAssignment(target, value); write(", "); emit(value); @@ -26618,10 +26625,11 @@ var ts; if (ts.isBindingPattern(target.name)) { var pattern = target.name; var elements = pattern.elements; - if (elements.length !== 1) { - value = ensureIdentifier(value); + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0); } - for (var i = 0; i < elements.length; i++) { + for (var i = 0; i < numElements; i++) { var element = elements[i]; if (pattern.kind === 159) { var propName = element.propertyName || element.name; @@ -26631,7 +26639,7 @@ var ts; if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } - else if (i === elements.length - 1) { + else if (i === numElements - 1) { emitBindingElement(element, createSliceCall(value, i)); } } @@ -27751,50 +27759,49 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { - if (!node) { - return; - } - switch (node.kind) { - case 101: - write("void 0"); - return; - case 158: - emitSerializedTypeNode(node.type); - return; - case 150: - case 151: - write("Function"); - return; - case 154: - case 155: - write("Array"); - return; - case 148: - case 118: - write("Boolean"); - return; - case 128: - case 9: - write("String"); - return; - case 126: - write("Number"); - return; - case 129: - write("Symbol"); - return; - case 149: - emitSerializedTypeReferenceNode(node); - return; - case 152: - case 153: - case 156: - case 157: - case 115: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; + if (node) { + switch (node.kind) { + case 101: + write("void 0"); + return; + case 158: + emitSerializedTypeNode(node.type); + return; + case 150: + case 151: + write("Function"); + return; + case 154: + case 155: + write("Array"); + return; + case 148: + case 118: + write("Boolean"); + return; + case 128: + case 9: + write("String"); + return; + case 126: + write("Number"); + return; + case 129: + write("Symbol"); + return; + case 149: + emitSerializedTypeReferenceNode(node); + return; + case 152: + case 153: + case 156: + case 157: + case 115: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } } write("Object"); } @@ -29794,7 +29801,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.6.0"; + ts.version = "1.6.2"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -32681,7 +32688,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234) { return n; } var children = n.getChildren(); @@ -32689,21 +32696,22 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (nodeHasTokens(child)) { - if (position <= child.end) { - if (child.getStart(sourceFile) >= position) { - var candidate = findRightmostChildNodeWithTokens(children, i); - return candidate && findRightmostToken(candidate); - } - else { - return find(child); - } + if (position < child.end && (nodeHasTokens(child) || child.kind === 234)) { + var start = child.getStart(sourceFile); + var lookInPreviousChild = (start >= position) || + (child.kind === 234 && start === child.end); + if (lookInPreviousChild) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); } } } @@ -33143,6 +33151,18 @@ var ts; } return false; } + function shouldRescanJsxIdentifier(node) { + if (node.parent) { + switch (node.parent.kind) { + case 236: + case 233: + case 235: + case 232: + return node.kind === 67; + } + } + return false; + } function shouldRescanSlashToken(container) { return container.kind === 10; } @@ -33167,7 +33187,9 @@ var ts; ? 2 : shouldRescanTemplateToken(n) ? 3 - : 0; + : shouldRescanJsxIdentifier(n) + ? 4 + : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -33191,6 +33213,10 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3; } + else if (expectedScanAction === 4 && currentToken === 67) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = 4; + } else { lastScanAction = 0; } @@ -33469,7 +33495,7 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67, 3]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67, 3, 71]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 77, 98, 83, 78]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); @@ -33536,6 +33562,8 @@ var ts; this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -33566,6 +33594,7 @@ var ts; this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, + this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, @@ -33736,6 +33765,7 @@ var ts; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { case 212: + case 184: case 213: case 215: case 153: @@ -35266,6 +35296,7 @@ var ts; function nodeContentIsAlwaysIndented(kind) { switch (kind) { case 212: + case 184: case 213: case 215: case 214: @@ -35290,13 +35321,13 @@ var ts; case 160: case 159: case 231: + case 232: case 140: case 145: case 146: case 136: case 150: case 151: - case 156: case 158: case 168: case 176: @@ -36267,7 +36298,7 @@ var ts; var outputText; var sourceMapText; var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); @@ -36581,6 +36612,24 @@ var ts; } } } + else if (token === 87) { + token = scanner.scan(); + if (token === 67 || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 55) { + token = scanner.scan(); + if (token === 125) { + token = scanner.scan(); + if (token === 17) { + token = scanner.scan(); + if (token === 9) { + recordModuleName(); + } + } + } + } + } + } } token = scanner.scan(); } diff --git a/lib/typescript.js b/lib/typescript.js index b4d21639d3b..f6701d019cc 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -2433,13 +2433,14 @@ var ts; Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, + Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, + Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, @@ -17021,7 +17022,7 @@ var ts; * @param target The right-hand-side of the relation. * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. - * @param errorNode The node upon which all errors will be reported, if defined. + * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. * @param containingMessageChain A chain of errors to prepend any new errors found. */ @@ -17228,6 +17229,10 @@ var ts; var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + // We know *exactly* where things went wrong when comparing the types. + // Use this property as the error node as this will be more helpful in + // reasoning about what went wrong. + errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } return true; @@ -25637,7 +25642,10 @@ var ts; var symbols = []; var name_15 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - symbols.push(getPropertyOfType(t, name_15)); + var symbol = getPropertyOfType(t, name_15); + if (symbol) { + symbols.push(symbol); + } }); return symbols; } @@ -29561,8 +29569,10 @@ var ts; function jsxEmitPreserve(node) { function emitJsxAttribute(node) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node) { write("{..."); @@ -31270,21 +31280,30 @@ var ts; write(")"); } } - function ensureIdentifier(expr) { - if (expr.kind !== 67 /* Identifier */) { - var identifier = createTempVariable(0 /* Auto */); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - expr = identifier; + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * This function is useful to ensure that the expression's value can be read from in subsequent expressions. + * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. + * + * @param expr the expression whose value needs to be bound. + * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; + * false if it is necessary to always emit an identifier. + */ + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 67 /* Identifier */ && reuseIdentifierExpressions) { + return expr; } - return expr; + var identifier = createTempVariable(0 /* Auto */); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + return identifier; } function createDefaultValueCheck(value, defaultValue) { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); // Return the expression 'value === void 0 ? defaultValue : value' var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); equals.left = value; @@ -31330,7 +31349,7 @@ var ts; if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; @@ -31345,7 +31364,7 @@ var ts; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; @@ -31387,7 +31406,7 @@ var ts; if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write("("); } - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); emitDestructuringAssignment(target, value); write(", "); emit(value); @@ -31408,12 +31427,15 @@ var ts; if (ts.isBindingPattern(target.name)) { var pattern = target.name; var elements = pattern.elements; - if (elements.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); } - for (var i = 0; i < elements.length; i++) { + for (var i = 0; i < numElements; i++) { var element = elements[i]; if (pattern.kind === 159 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property @@ -31425,7 +31447,7 @@ var ts; // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } - else if (i === elements.length - 1) { + else if (i === numElements - 1) { emitBindingElement(element, createSliceCall(value, i)); } } @@ -32840,50 +32862,49 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { - if (!node) { - return; - } - switch (node.kind) { - case 101 /* VoidKeyword */: - write("void 0"); - return; - case 158 /* ParenthesizedType */: - emitSerializedTypeNode(node.type); - return; - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - write("Function"); - return; - case 154 /* ArrayType */: - case 155 /* TupleType */: - write("Array"); - return; - case 148 /* TypePredicate */: - case 118 /* BooleanKeyword */: - write("Boolean"); - return; - case 128 /* StringKeyword */: - case 9 /* StringLiteral */: - write("String"); - return; - case 126 /* NumberKeyword */: - write("Number"); - return; - case 129 /* SymbolKeyword */: - write("Symbol"); - return; - case 149 /* TypeReference */: - emitSerializedTypeReferenceNode(node); - return; - case 152 /* TypeQuery */: - case 153 /* TypeLiteral */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 115 /* AnyKeyword */: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; + if (node) { + switch (node.kind) { + case 101 /* VoidKeyword */: + write("void 0"); + return; + case 158 /* ParenthesizedType */: + emitSerializedTypeNode(node.type); + return; + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + write("Function"); + return; + case 154 /* ArrayType */: + case 155 /* TupleType */: + write("Array"); + return; + case 148 /* TypePredicate */: + case 118 /* BooleanKeyword */: + write("Boolean"); + return; + case 128 /* StringKeyword */: + case 9 /* StringLiteral */: + write("String"); + return; + case 126 /* NumberKeyword */: + write("Number"); + return; + case 129 /* SymbolKeyword */: + write("Symbol"); + return; + case 149 /* TypeReference */: + emitSerializedTypeReferenceNode(node); + return; + case 152 /* TypeQuery */: + case 153 /* TypeLiteral */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 115 /* AnyKeyword */: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } } write("Object"); } @@ -35103,7 +35124,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.6.0"; + ts.version = "1.6.2"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -36251,8 +36272,8 @@ var ts; "node": 2 /* NodeJs */, "classic": 1 /* Classic */ }, - experimental: true, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 + description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic } ]; var optionNameMapCache; @@ -38721,7 +38742,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38729,23 +38750,32 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234 /* JsxText */) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (nodeHasTokens(child)) { - if (position <= child.end) { - if (child.getStart(sourceFile) >= position) { - // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); - return candidate && findRightmostToken(candidate); - } - else { - // candidate should be in this node - return find(child); - } + // condition 'position < child.end' checks if child node end after the position + // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' + // aaaa___bbbb___$__ccc + // after we found child node with end after the position we check if start of the node is after the position. + // if yes - then position is in the trivia and we need to look into the previous child to find the token in question. + // if no - position is in the node itself so we should recurse in it. + // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). + // if this is the case - then we should assume that token in question is located in previous child. + if (position < child.end && (nodeHasTokens(child) || child.kind === 234 /* JsxText */)) { + var start = child.getStart(sourceFile); + var lookInPreviousChild = (start >= position) || + (child.kind === 234 /* JsxText */ && start === child.end); // whitespace only JsxText + if (lookInPreviousChild) { + // actual start of the node is past the position - previous token should be at the end of previous child + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + return candidate && findRightmostToken(candidate); + } + else { + // candidate should be in this node + return find(child); } } } @@ -39162,6 +39192,7 @@ var ts; ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; })(ScanAction || (ScanAction = {})); function getFormattingScanner(sourceFile, startPos, endPos) { scanner.setText(sourceFile.text); @@ -39235,6 +39266,18 @@ var ts; } return false; } + function shouldRescanJsxIdentifier(node) { + if (node.parent) { + switch (node.parent.kind) { + case 236 /* JsxAttribute */: + case 233 /* JsxOpeningElement */: + case 235 /* JsxClosingElement */: + case 232 /* JsxSelfClosingElement */: + return node.kind === 67 /* Identifier */; + } + } + return false; + } function shouldRescanSlashToken(container) { return container.kind === 10 /* RegularExpressionLiteral */; } @@ -39262,7 +39305,9 @@ var ts; ? 2 /* RescanSlashToken */ : shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ - : 0 /* Scan */; + : shouldRescanJsxIdentifier(n) + ? 4 /* RescanJsxIdentifier */ + : 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -39293,6 +39338,10 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } + else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 67 /* Identifier */) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = 4 /* RescanJsxIdentifier */; + } else { lastScanAction = 0 /* Scan */; } @@ -39633,7 +39682,7 @@ var ts; this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */, 71 /* ClassKeyword */]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); @@ -39727,11 +39776,13 @@ var ts; // template string this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // union type + // type operation this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45 /* AmpersandToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45 /* AmpersandToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39763,6 +39814,7 @@ var ts; this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, + this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -39967,6 +40019,7 @@ var ts; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: case 213 /* InterfaceDeclaration */: case 215 /* EnumDeclaration */: case 153 /* TypeLiteral */: @@ -41704,6 +41757,7 @@ var ts; function nodeContentIsAlwaysIndented(kind) { switch (kind) { case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: case 213 /* InterfaceDeclaration */: case 215 /* EnumDeclaration */: case 214 /* TypeAliasDeclaration */: @@ -41728,13 +41782,13 @@ var ts; case 160 /* ArrayBindingPattern */: case 159 /* ObjectBindingPattern */: case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: case 140 /* MethodSignature */: case 145 /* CallSignature */: case 146 /* ConstructSignature */: case 136 /* Parameter */: case 150 /* FunctionType */: case 151 /* ConstructorType */: - case 156 /* UnionType */: case 158 /* ParenthesizedType */: case 168 /* TaggedTemplateExpression */: case 176 /* AwaitExpression */: @@ -42858,7 +42912,7 @@ var ts; var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); @@ -43106,6 +43160,7 @@ var ts; // // export * from "mod" // export {a as b} from "mod" + // export import i = require("mod") while (token !== 1 /* EndOfFileToken */) { if (token === 120 /* DeclareKeyword */) { // declare module "mod" @@ -43226,6 +43281,25 @@ var ts; } } } + else if (token === 87 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 55 /* EqualsToken */) { + token = scanner.scan(); + if (token === 125 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export import i = require("mod"); + recordModuleName(); + } + } + } + } + } + } } token = scanner.scan(); } diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index b4d21639d3b..f6701d019cc 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -2433,13 +2433,14 @@ var ts; Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" }, Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, + Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, + Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, @@ -17021,7 +17022,7 @@ var ts; * @param target The right-hand-side of the relation. * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. - * @param errorNode The node upon which all errors will be reported, if defined. + * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. * @param containingMessageChain A chain of errors to prepend any new errors found. */ @@ -17228,6 +17229,10 @@ var ts; var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { if (reportErrors) { + // We know *exactly* where things went wrong when comparing the types. + // Use this property as the error node as this will be more helpful in + // reasoning about what went wrong. + errorNode = prop.valueDeclaration; reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); } return true; @@ -25637,7 +25642,10 @@ var ts; var symbols = []; var name_15 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - symbols.push(getPropertyOfType(t, name_15)); + var symbol = getPropertyOfType(t, name_15); + if (symbol) { + symbols.push(symbol); + } }); return symbols; } @@ -29561,8 +29569,10 @@ var ts; function jsxEmitPreserve(node) { function emitJsxAttribute(node) { emit(node.name); - write("="); - emit(node.initializer); + if (node.initializer) { + write("="); + emit(node.initializer); + } } function emitJsxSpreadAttribute(node) { write("{..."); @@ -31270,21 +31280,30 @@ var ts; write(")"); } } - function ensureIdentifier(expr) { - if (expr.kind !== 67 /* Identifier */) { - var identifier = createTempVariable(0 /* Auto */); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - expr = identifier; + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * This function is useful to ensure that the expression's value can be read from in subsequent expressions. + * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. + * + * @param expr the expression whose value needs to be bound. + * @param reuseIdentifierExpressions true if identifier expressions can simply be returned; + * false if it is necessary to always emit an identifier. + */ + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 67 /* Identifier */ && reuseIdentifierExpressions) { + return expr; } - return expr; + var identifier = createTempVariable(0 /* Auto */); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + return identifier; } function createDefaultValueCheck(value, defaultValue) { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); // Return the expression 'value === void 0 ? defaultValue : value' var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); equals.left = value; @@ -31330,7 +31349,7 @@ var ts; if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; @@ -31345,7 +31364,7 @@ var ts; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); } for (var i = 0; i < elements.length; i++) { var e = elements[i]; @@ -31387,7 +31406,7 @@ var ts; if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write("("); } - value = ensureIdentifier(value); + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true); emitDestructuringAssignment(target, value); write(", "); emit(value); @@ -31408,12 +31427,15 @@ var ts; if (ts.isBindingPattern(target.name)) { var pattern = target.name; var elements = pattern.elements; - if (elements.length !== 1) { - // For anything but a single element destructuring we need to generate a temporary - // to ensure value is evaluated exactly once. - value = ensureIdentifier(value); + var numElements = elements.length; + if (numElements !== 1) { + // For anything other than a single-element destructuring we need to generate a temporary + // to ensure value is evaluated exactly once. Additionally, if we have zero elements + // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, + // so in that case, we'll intentionally create that temporary. + value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0); } - for (var i = 0; i < elements.length; i++) { + for (var i = 0; i < numElements; i++) { var element = elements[i]; if (pattern.kind === 159 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property @@ -31425,7 +31447,7 @@ var ts; // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } - else if (i === elements.length - 1) { + else if (i === numElements - 1) { emitBindingElement(element, createSliceCall(value, i)); } } @@ -32840,50 +32862,49 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { - if (!node) { - return; - } - switch (node.kind) { - case 101 /* VoidKeyword */: - write("void 0"); - return; - case 158 /* ParenthesizedType */: - emitSerializedTypeNode(node.type); - return; - case 150 /* FunctionType */: - case 151 /* ConstructorType */: - write("Function"); - return; - case 154 /* ArrayType */: - case 155 /* TupleType */: - write("Array"); - return; - case 148 /* TypePredicate */: - case 118 /* BooleanKeyword */: - write("Boolean"); - return; - case 128 /* StringKeyword */: - case 9 /* StringLiteral */: - write("String"); - return; - case 126 /* NumberKeyword */: - write("Number"); - return; - case 129 /* SymbolKeyword */: - write("Symbol"); - return; - case 149 /* TypeReference */: - emitSerializedTypeReferenceNode(node); - return; - case 152 /* TypeQuery */: - case 153 /* TypeLiteral */: - case 156 /* UnionType */: - case 157 /* IntersectionType */: - case 115 /* AnyKeyword */: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; + if (node) { + switch (node.kind) { + case 101 /* VoidKeyword */: + write("void 0"); + return; + case 158 /* ParenthesizedType */: + emitSerializedTypeNode(node.type); + return; + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + write("Function"); + return; + case 154 /* ArrayType */: + case 155 /* TupleType */: + write("Array"); + return; + case 148 /* TypePredicate */: + case 118 /* BooleanKeyword */: + write("Boolean"); + return; + case 128 /* StringKeyword */: + case 9 /* StringLiteral */: + write("String"); + return; + case 126 /* NumberKeyword */: + write("Number"); + return; + case 129 /* SymbolKeyword */: + write("Symbol"); + return; + case 149 /* TypeReference */: + emitSerializedTypeReferenceNode(node); + return; + case 152 /* TypeQuery */: + case 153 /* TypeLiteral */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 115 /* AnyKeyword */: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } } write("Object"); } @@ -35103,7 +35124,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.6.0"; + ts.version = "1.6.2"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -36251,8 +36272,8 @@ var ts; "node": 2 /* NodeJs */, "classic": 1 /* Classic */ }, - experimental: true, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 + description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic } ]; var optionNameMapCache; @@ -38721,7 +38742,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234 /* JsxText */) { return n; } var children = n.getChildren(); @@ -38729,23 +38750,32 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (isToken(n) || n.kind === 234 /* JsxText */) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (nodeHasTokens(child)) { - if (position <= child.end) { - if (child.getStart(sourceFile) >= position) { - // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); - return candidate && findRightmostToken(candidate); - } - else { - // candidate should be in this node - return find(child); - } + // condition 'position < child.end' checks if child node end after the position + // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' + // aaaa___bbbb___$__ccc + // after we found child node with end after the position we check if start of the node is after the position. + // if yes - then position is in the trivia and we need to look into the previous child to find the token in question. + // if no - position is in the node itself so we should recurse in it. + // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). + // if this is the case - then we should assume that token in question is located in previous child. + if (position < child.end && (nodeHasTokens(child) || child.kind === 234 /* JsxText */)) { + var start = child.getStart(sourceFile); + var lookInPreviousChild = (start >= position) || + (child.kind === 234 /* JsxText */ && start === child.end); // whitespace only JsxText + if (lookInPreviousChild) { + // actual start of the node is past the position - previous token should be at the end of previous child + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + return candidate && findRightmostToken(candidate); + } + else { + // candidate should be in this node + return find(child); } } } @@ -39162,6 +39192,7 @@ var ts; ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; })(ScanAction || (ScanAction = {})); function getFormattingScanner(sourceFile, startPos, endPos) { scanner.setText(sourceFile.text); @@ -39235,6 +39266,18 @@ var ts; } return false; } + function shouldRescanJsxIdentifier(node) { + if (node.parent) { + switch (node.parent.kind) { + case 236 /* JsxAttribute */: + case 233 /* JsxOpeningElement */: + case 235 /* JsxClosingElement */: + case 232 /* JsxSelfClosingElement */: + return node.kind === 67 /* Identifier */; + } + } + return false; + } function shouldRescanSlashToken(container) { return container.kind === 10 /* RegularExpressionLiteral */; } @@ -39262,7 +39305,9 @@ var ts; ? 2 /* RescanSlashToken */ : shouldRescanTemplateToken(n) ? 3 /* RescanTemplateToken */ - : 0 /* Scan */; + : shouldRescanJsxIdentifier(n) + ? 4 /* RescanJsxIdentifier */ + : 0 /* Scan */; if (lastTokenInfo && expectedScanAction === lastScanAction) { // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' @@ -39293,6 +39338,10 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } + else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 67 /* Identifier */) { + currentToken = scanner.scanJsxIdentifier(); + lastScanAction = 4 /* RescanJsxIdentifier */; + } else { lastScanAction = 0 /* Scan */; } @@ -39633,7 +39682,7 @@ var ts; this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */, 71 /* ClassKeyword */]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); @@ -39727,11 +39776,13 @@ var ts; // template string this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // union type + // type operation this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45 /* AmpersandToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45 /* AmpersandToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39763,6 +39814,7 @@ var ts; this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, + this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -39967,6 +40019,7 @@ var ts; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: case 213 /* InterfaceDeclaration */: case 215 /* EnumDeclaration */: case 153 /* TypeLiteral */: @@ -41704,6 +41757,7 @@ var ts; function nodeContentIsAlwaysIndented(kind) { switch (kind) { case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: case 213 /* InterfaceDeclaration */: case 215 /* EnumDeclaration */: case 214 /* TypeAliasDeclaration */: @@ -41728,13 +41782,13 @@ var ts; case 160 /* ArrayBindingPattern */: case 159 /* ObjectBindingPattern */: case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: case 140 /* MethodSignature */: case 145 /* CallSignature */: case 146 /* ConstructSignature */: case 136 /* Parameter */: case 150 /* FunctionType */: case 151 /* ConstructorType */: - case 156 /* UnionType */: case 158 /* ParenthesizedType */: case 168 /* TaggedTemplateExpression */: case 176 /* AwaitExpression */: @@ -42858,7 +42912,7 @@ var ts; var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, + getSourceFile: function (fileName, target) { return fileName === ts.normalizeSlashes(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { if (ts.fileExtensionIs(name, ".map")) { ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); @@ -43106,6 +43160,7 @@ var ts; // // export * from "mod" // export {a as b} from "mod" + // export import i = require("mod") while (token !== 1 /* EndOfFileToken */) { if (token === 120 /* DeclareKeyword */) { // declare module "mod" @@ -43226,6 +43281,25 @@ var ts; } } } + else if (token === 87 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { + token = scanner.scan(); + if (token === 55 /* EqualsToken */) { + token = scanner.scan(); + if (token === 125 /* RequireKeyword */) { + token = scanner.scan(); + if (token === 17 /* OpenParenToken */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + // export import i = require("mod"); + recordModuleName(); + } + } + } + } + } + } } token = scanner.scan(); } From 4b5c2fe31c94a6f3e4422024107a70e96a14c3d8 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 10 Sep 2015 10:46:39 -0700 Subject: [PATCH 28/75] reattach file diagnostics for modified files when reusing program structure --- src/compiler/program.ts | 78 +++++++++++-------- src/compiler/types.ts | 3 + src/compiler/utilities.ts | 13 +++- .../cases/unittests/reuseProgramStructure.ts | 9 ++- 4 files changed, 67 insertions(+), 36 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c239b18efb7..925ebfeb8af 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -358,7 +358,8 @@ namespace ts { export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program { let program: Program; let files: SourceFile[] = []; - let diagnostics = createDiagnosticCollection(); + let fileProcessingDiagnostics = createDiagnosticCollection(); + let programDiagnostics = createDiagnosticCollection(); let commonSourceDirectory: string; let diagnosticsProducingTypeChecker: TypeChecker; @@ -428,6 +429,7 @@ namespace ts { getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(), getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(), getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(), + getFileProcessingDiagnostics: () => fileProcessingDiagnostics }; return program; @@ -460,6 +462,7 @@ namespace ts { // check if program source files has changed in the way that can affect structure of the program let newSourceFiles: SourceFile[] = []; + let modifiedSourceFiles: SourceFile[] = []; for (let oldSourceFile of oldProgram.getSourceFiles()) { let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { @@ -499,6 +502,7 @@ namespace ts { } // pass the cache of module resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { // file has no changes - use it as is @@ -515,7 +519,11 @@ namespace ts { } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (let modifiedFile of modifiedSourceFiles) { + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; @@ -645,9 +653,10 @@ namespace ts { Debug.assert(!!sourceFile.bindDiagnostics); let bindDiagnostics = sourceFile.bindDiagnostics; let checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - let programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + let fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + let programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } @@ -664,7 +673,8 @@ namespace ts { function getOptionsDiagnostics(): Diagnostic[] { let allDiagnostics: Diagnostic[] = []; - addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()) + addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return sortAndDeduplicateDiagnostics(allDiagnostics); } @@ -772,10 +782,10 @@ namespace ts { if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument)); + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument)); } else { - diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); } } } @@ -797,11 +807,11 @@ namespace ts { // We haven't looked for this file, do so now and cache result let file = host.getSourceFile(fileName, options.target, hostErrorMessage => { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -837,11 +847,11 @@ namespace ts { let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, + fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -877,7 +887,7 @@ namespace ts { return; function findModuleSourceFile(fileName: string, nameLiteral: Expression) { - return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, /* isDefaultLib */ false, file, skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } @@ -902,7 +912,7 @@ namespace ts { for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } @@ -931,7 +941,7 @@ namespace ts { if (!isDeclarationFile(sourceFile)) { let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -944,52 +954,52 @@ namespace ts { function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -1000,24 +1010,24 @@ namespace ts { let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { if (!options.module && languageVersion < ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); if (firstNonExternalModuleSourceFile) { let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot @@ -1046,30 +1056,30 @@ namespace ts { if (options.noEmit) { if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== ScriptTarget.ES6) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f9d1b506274..5b5e7aef743 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1359,6 +1359,7 @@ namespace ts { /* @internal */ getSymbolCount(): number; /* @internal */ getTypeCount(): number; + /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; // For testing purposes only. /* @internal */ structureIsReused?: boolean; } @@ -2335,5 +2336,7 @@ namespace ts { // operation caused diagnostics to be returned by storing and comparing the return value // of this method before/after the operation is performed. getModificationCount(): number; + + /* @internal */ reattachFileDiagnostics(newFile: SourceFile): void; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 99ea06532a0..6c5bd8df95d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1507,12 +1507,23 @@ namespace ts { add, getGlobalDiagnostics, getDiagnostics, - getModificationCount + getModificationCount, + reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + + function reattachFileDiagnostics(newFile: SourceFile): void { + if (!hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + + for (let diagnostic of fileDiagnostics[newFile.fileName]) { + diagnostic.file = newFile; + } + } function add(diagnostic: Diagnostic): void { let diagnostics: Diagnostic[]; diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 6c043299c8f..56b1dedbcbb 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -184,7 +184,11 @@ module ts { describe("Reuse program structure", () => { let target = ScriptTarget.Latest; let files = [ - { name: "a.ts", text: SourceText.New(`/// `, "", `var x = 1`) }, + { name: "a.ts", text: SourceText.New( + ` +/// +/// +`, "",`var x = 1`) }, { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, ] @@ -195,6 +199,9 @@ module ts { files[0].text = files[0].text.updateProgram("var x = 100"); }); assert.isTrue(program_1.structureIsReused); + let program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + let program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + assert.equal(program1Diagnostics.length, program2Diagnostics.length); }); it("fails if change affects tripleslash references", () => { From 98f31635f89ac52da14f8ccbeb8fc6bfbfc18014 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 10 Sep 2015 11:36:31 -0700 Subject: [PATCH 29/75] Check if imported file is a proper external module --- src/compiler/checker.ts | 4 +- .../diagnosticInformationMap.generated.ts | 2 + src/compiler/diagnosticMessages.json | 8 ++ src/compiler/program.ts | 91 +++++++++---------- src/compiler/types.ts | 17 +++- src/compiler/utilities.ts | 10 +- src/harness/harnessLanguageService.ts | 4 +- src/server/editorServices.ts | 14 +-- src/services/services.ts | 4 +- src/services/shims.ts | 13 ++- tests/baselines/reference/nodeResolution4.js | 17 ++++ .../reference/nodeResolution4.symbols | 14 +++ .../baselines/reference/nodeResolution4.types | 15 +++ .../reference/nodeResolution5.errors.txt | 14 +++ tests/baselines/reference/nodeResolution5.js | 13 +++ .../reference/nodeResolution6.errors.txt | 17 ++++ tests/baselines/reference/nodeResolution6.js | 18 ++++ .../reference/nodeResolution7.errors.txt | 14 +++ tests/baselines/reference/nodeResolution7.js | 13 +++ .../reference/nodeResolution8.errors.txt | 16 ++++ tests/baselines/reference/nodeResolution8.js | 17 ++++ tests/cases/compiler/nodeResolution4.ts | 12 +++ tests/cases/compiler/nodeResolution5.ts | 10 ++ tests/cases/compiler/nodeResolution6.ts | 13 +++ tests/cases/compiler/nodeResolution7.ts | 10 ++ tests/cases/compiler/nodeResolution8.ts | 13 +++ tests/cases/unittests/moduleResolution.ts | 79 +++------------- .../cases/unittests/reuseProgramStructure.ts | 19 +++- 28 files changed, 347 insertions(+), 144 deletions(-) create mode 100644 tests/baselines/reference/nodeResolution4.js create mode 100644 tests/baselines/reference/nodeResolution4.symbols create mode 100644 tests/baselines/reference/nodeResolution4.types create mode 100644 tests/baselines/reference/nodeResolution5.errors.txt create mode 100644 tests/baselines/reference/nodeResolution5.js create mode 100644 tests/baselines/reference/nodeResolution6.errors.txt create mode 100644 tests/baselines/reference/nodeResolution6.js create mode 100644 tests/baselines/reference/nodeResolution7.errors.txt create mode 100644 tests/baselines/reference/nodeResolution7.js create mode 100644 tests/baselines/reference/nodeResolution8.errors.txt create mode 100644 tests/baselines/reference/nodeResolution8.js create mode 100644 tests/cases/compiler/nodeResolution4.ts create mode 100644 tests/cases/compiler/nodeResolution5.ts create mode 100644 tests/cases/compiler/nodeResolution6.ts create mode 100644 tests/cases/compiler/nodeResolution7.ts create mode 100644 tests/cases/compiler/nodeResolution8.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6c45f630ed7..0ae5bc8e795 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -976,8 +976,8 @@ namespace ts { } } - let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - let sourceFile = fileName && host.getSourceFile(fileName); + let resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + let sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 1c9232d1515..2b67d676d51 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -427,6 +427,8 @@ namespace ts { Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Proper_external_module_that_carries_external_typings_cannot_contain_tripleslash_references: { code: 2654, category: DiagnosticCategory.Error, key: "Proper external module that carries external typings cannot contain tripleslash references." }, + Proper_external_module_that_carries_external_typings_should_be_d_ts_file: { code: 2655, category: DiagnosticCategory.Error, key: "Proper external module that carries external typings should be '.d.ts' file." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f6875c45c47..ad82541ad79 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1697,6 +1697,14 @@ "category": "Error", "code": 2652 }, + "Proper external module that carries external typings cannot contain tripleslash references.": { + "category": "Error", + "code": 2654 + }, + "Proper external module that carries external typings should be '.d.ts' file.": { + "category": "Error", + "code": 2655 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 925ebfeb8af..f6931aea545 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -36,7 +36,7 @@ namespace ts { return normalizePath(referencedFileName); } - export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let moduleResolution = compilerOptions.moduleResolution !== undefined ? compilerOptions.moduleResolution : compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; @@ -47,7 +47,7 @@ namespace ts { } } - export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule { + export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let containingDirectory = getDirectoryPath(containingFile); if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { @@ -56,11 +56,13 @@ namespace ts { let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName, failedLookupLocations }; + return { resolvedModule: { resolvedFileName }, failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); - return { resolvedFileName, failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName }, failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -117,7 +119,7 @@ namespace ts { return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); } - function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule { + function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { let failedLookupLocations: string[] = []; directory = normalizeSlashes(directory); while (true) { @@ -127,12 +129,12 @@ namespace ts { let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, shouldBeProperExternalModule: true }, failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, shouldBeProperExternalModule: true }, failedLookupLocations }; } } @@ -144,47 +146,19 @@ namespace ts { directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations }; - } - - export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule { - Debug.assert(baseUrl !== undefined); - - let normalizedModuleName = normalizeSlashes(moduleName); - let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile); - let candidate = normalizePath(combinePaths(basePart, moduleName)); - - let failedLookupLocations: string[] = []; - - return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations }; - - function tryLoadFile(location: string): ResolvedModule { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } + return { resolvedModule: undefined, failedLookupLocations }; } function nameStartsWithDotSlashOrDotDotSlash(name: string) { let i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot); } - - function useBaseUrl(moduleName: string): boolean { - // path is not rooted - // module name does not start with './' or '../' - return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } - export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } let searchPath = getDirectoryPath(containingFile); @@ -222,7 +196,9 @@ namespace ts { searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations }; } /* @internal */ @@ -372,9 +348,9 @@ namespace ts { host = host || createCompilerHost(options); - const resolveModuleNamesWorker = - host.resolveModuleNames || - ((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName)); + const resolveModuleNamesWorker = host.resolveModuleNames + ? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile)) + : ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule)); let filesByName = createFileMap(fileName => host.getCanonicalFileName(fileName)); @@ -494,10 +470,17 @@ namespace ts { let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); // ensure that module resolution results are still correct for (let i = 0; i < moduleNames.length; ++i) { - let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + let newResolution = resolutions[i]; + let oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]); + let resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.shouldBeProperExternalModule !== !!newResolution.shouldBeProperExternalModule + : newResolution; + + if (resolutionChanged) { return false; - } + } } } // pass the cache of module resolutions from the old source file @@ -874,9 +857,23 @@ namespace ts { let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (let i = 0; i < file.imports.length; ++i) { let resolution = resolutions[i]; - setResolvedModuleName(file, moduleNames[i], resolution); + setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.shouldBeProperExternalModule) { + if (!isExternalModule(importedFile)) { + let start = getTokenPosOfNode(file.imports[i], file) + diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + } + else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) { + let start = getTokenPosOfNode(file.imports[i], file) + diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Proper_external_module_that_carries_external_typings_should_be_d_ts_file)); + } + else if (importedFile.referencedFiles.length) { + let firstRef = importedFile.referencedFiles[0]; + diagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Proper_external_module_that_carries_external_typings_cannot_contain_tripleslash_references)); + } + } } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5b5e7aef743..191d723afa2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1284,7 +1284,7 @@ namespace ts { // Stores a mapping 'external module reference text' -> 'resolved file name' | undefined // It is used to resolve module names in the checker. // Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead - /* @internal */ resolvedModules: Map; + /* @internal */ resolvedModules: Map; /* @internal */ imports: LiteralExpression[]; } @@ -2283,11 +2283,20 @@ namespace ts { export interface ResolvedModule { resolvedFileName: string; + /* + * Denotes if 'resolvedFileName' should be proper external module: + * - be a .d.ts file + * - use top level imports\exports + * - don't use tripleslash references + */ + shouldBeProperExternalModule?: boolean; + } + + export interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModule; failedLookupLocations: string[]; } - export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; - export interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; @@ -2305,7 +2314,7 @@ namespace ts { * If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just * 'throw new Error("NotImplemented")' */ - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } export interface TextSpan { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6c5bd8df95d..5332c8fb440 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -99,20 +99,20 @@ namespace ts { return true; } - export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean { + export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean { return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText); } - export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void { + export function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } // Returns true if this node contains a parse error anywhere underneath it. diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index f228bc862d8..c97ce50d275 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -225,8 +225,8 @@ module Harness.LanguageService { let imports: ts.Map = {}; for (let module of preprocessInfo.importedFiles) { let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); - if (resolutionInfo.resolvedFileName) { - imports[module.fileName] = resolutionInfo.resolvedFileName; + if (resolutionInfo.resolvedModule) { + imports[module.fileName] = resolutionInfo.resolvedModule.resolvedFileName; } } return JSON.stringify(imports); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index dd29d3cf2c9..572656b98fb 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -79,7 +79,7 @@ namespace ts.server { } } - interface TimestampedResolvedModule extends ResolvedModule { + interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations { lastCheckTime: number; } @@ -99,11 +99,11 @@ namespace ts.server { } } - resolveModuleNames(moduleNames: string[], containingFile: string): string[] { + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); let newResolutions: Map = {}; - let resolvedFileNames: string[] = []; + let resolvedModules: ResolvedModule[] = []; let compilerOptions = this.getCompilationSettings(); @@ -119,25 +119,25 @@ namespace ts.server { else { resolution = resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[moduleName] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedFileNames.push(resolution.resolvedFileName); + resolvedModules.push(resolution.resolvedModule); } // replace old results with a new one this.resolvedModuleNames.set(containingFile, newResolutions); - return resolvedFileNames; + return resolvedModules; function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean { if (!resolution) { return false; } - if (resolution.resolvedFileName) { + if (resolution.resolvedModule) { // TODO: consider checking failedLookupLocations // TODO: use lastCheckTime to track expiration for module name resolution return true; diff --git a/src/services/services.ts b/src/services/services.ts index 58f59843078..c3df7a8a9f8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -802,7 +802,7 @@ namespace ts { public languageVariant: LanguageVariant; public identifiers: Map; public nameTable: Map; - public resolvedModules: Map; + public resolvedModules: Map; public imports: LiteralExpression[]; private namedDeclarations: Map; @@ -1022,7 +1022,7 @@ namespace ts { * if implementation is omitted then language service will use built-in module resolution logic and get answers to * host specific questions using 'getScriptSnapshot'. */ - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } // diff --git a/src/services/shims.ts b/src/services/shims.ts index 307062cebd8..351514a1499 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -273,7 +273,7 @@ namespace ts { private loggingEnabled = false; private tracingEnabled = false; - public resolveModuleNames: (moduleName: string[], containingFile: string) => string[]; + public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; constructor(private shimHost: LanguageServiceShimHost) { // if shimHost is a COM object then property check will become method call with no arguments. @@ -281,7 +281,10 @@ namespace ts { if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = (moduleNames: string[], containingFile: string) => { let resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); - return map(moduleNames, name => lookUp(resolutionsInFile, name)); + return map(moduleNames, name => { + const result = lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); }; } } @@ -942,7 +945,11 @@ namespace ts { public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string { return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => { let compilerOptions = JSON.parse(compilerOptionsJson); - return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); + const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName: undefined, + failedLookupLocations: result.failedLookupLocations + }; }); } diff --git a/tests/baselines/reference/nodeResolution4.js b/tests/baselines/reference/nodeResolution4.js new file mode 100644 index 00000000000..0965c257da9 --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/nodeResolution4.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [a.ts] +/// +export var y; + +//// [b.ts] +import y = require("./a"); + +//// [ref.js] +var x = 1; +//// [a.js] +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution4.symbols b/tests/baselines/reference/nodeResolution4.symbols new file mode 100644 index 00000000000..b8e0b59284a --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : Symbol(y, Decl(b.ts, 0, 0)) + +=== tests/cases/compiler/ref.ts === + +var x = 1; +>x : Symbol(x, Decl(ref.ts, 1, 3)) + +=== tests/cases/compiler/a.ts === +/// +export var y; +>y : Symbol(y, Decl(a.ts, 1, 10)) + diff --git a/tests/baselines/reference/nodeResolution4.types b/tests/baselines/reference/nodeResolution4.types new file mode 100644 index 00000000000..b273b203bde --- /dev/null +++ b/tests/baselines/reference/nodeResolution4.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : typeof y + +=== tests/cases/compiler/ref.ts === + +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/a.ts === +/// +export var y; +>y : any + diff --git a/tests/baselines/reference/nodeResolution5.errors.txt b/tests/baselines/reference/nodeResolution5.errors.txt new file mode 100644 index 00000000000..1fc4e1cee52 --- /dev/null +++ b/tests/baselines/reference/nodeResolution5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/b.ts(1,20): error TS2306: File 'tests/cases/compiler/node_modules/a.d.ts' is not a module. + + +==== tests/cases/compiler/b.ts (1 errors) ==== + import y = require("a"); + ~~~ +!!! error TS2306: File 'a.d.ts' is not a module. + +==== tests/cases/compiler/node_modules/a.d.ts (0 errors) ==== + + declare module "a" { + var x: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution5.js b/tests/baselines/reference/nodeResolution5.js new file mode 100644 index 00000000000..2bc009c1522 --- /dev/null +++ b/tests/baselines/reference/nodeResolution5.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/nodeResolution5.ts] //// + +//// [a.d.ts] + +declare module "a" { + var x: number; +} + +//// [b.ts] +import y = require("a"); + + +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution6.errors.txt b/tests/baselines/reference/nodeResolution6.errors.txt new file mode 100644 index 00000000000..8a462043207 --- /dev/null +++ b/tests/baselines/reference/nodeResolution6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Proper external module that carries external typings cannot contain tripleslash references. + + +==== tests/cases/compiler/b.ts (0 errors) ==== + import y = require("a"); + +==== tests/cases/compiler/node_modules/ref.ts (0 errors) ==== + + var x = 1; + +==== tests/cases/compiler/node_modules/a.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2654: Proper external module that carries external typings cannot contain tripleslash references. + export declare var y; + + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution6.js b/tests/baselines/reference/nodeResolution6.js new file mode 100644 index 00000000000..140edd61f5a --- /dev/null +++ b/tests/baselines/reference/nodeResolution6.js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/nodeResolution6.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [a.d.ts] +/// +export declare var y; + + +//// [b.ts] +import y = require("a"); + + +//// [ref.js] +var x = 1; +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution7.errors.txt b/tests/baselines/reference/nodeResolution7.errors.txt new file mode 100644 index 00000000000..1e1f822f0d4 --- /dev/null +++ b/tests/baselines/reference/nodeResolution7.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/b.ts(1,20): error TS2306: File 'tests/cases/compiler/node_modules/a/index.d.ts' is not a module. + + +==== tests/cases/compiler/b.ts (1 errors) ==== + import y = require("a"); + ~~~ +!!! error TS2306: File 'index.d.ts' is not a module. + +==== tests/cases/compiler/node_modules/a/index.d.ts (0 errors) ==== + + declare module "a" { + var x: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution7.js b/tests/baselines/reference/nodeResolution7.js new file mode 100644 index 00000000000..abfbbad52a6 --- /dev/null +++ b/tests/baselines/reference/nodeResolution7.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/nodeResolution7.ts] //// + +//// [index.d.ts] + +declare module "a" { + var x: number; +} + +//// [b.ts] +import y = require("a"); + + +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution8.errors.txt b/tests/baselines/reference/nodeResolution8.errors.txt new file mode 100644 index 00000000000..82753a2049b --- /dev/null +++ b/tests/baselines/reference/nodeResolution8.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Proper external module that carries external typings cannot contain tripleslash references. + + +==== tests/cases/compiler/b.ts (0 errors) ==== + import y = require("a"); +==== tests/cases/compiler/node_modules/a/ref.ts (0 errors) ==== + + var x = 1; + +==== tests/cases/compiler/node_modules/a/index.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2654: Proper external module that carries external typings cannot contain tripleslash references. + export declare var y; + + \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution8.js b/tests/baselines/reference/nodeResolution8.js new file mode 100644 index 00000000000..aa67f4bf9cc --- /dev/null +++ b/tests/baselines/reference/nodeResolution8.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/nodeResolution8.ts] //// + +//// [ref.ts] + +var x = 1; + +//// [index.d.ts] +/// +export declare var y; + + +//// [b.ts] +import y = require("a"); + +//// [ref.js] +var x = 1; +//// [b.js] diff --git a/tests/cases/compiler/nodeResolution4.ts b/tests/cases/compiler/nodeResolution4.ts new file mode 100644 index 00000000000..247546c3f0c --- /dev/null +++ b/tests/cases/compiler/nodeResolution4.ts @@ -0,0 +1,12 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: ref.ts +var x = 1; + +// @filename: a.ts +/// +export var y; + +// @filename: b.ts +import y = require("./a"); \ No newline at end of file diff --git a/tests/cases/compiler/nodeResolution5.ts b/tests/cases/compiler/nodeResolution5.ts new file mode 100644 index 00000000000..313dabd7899 --- /dev/null +++ b/tests/cases/compiler/nodeResolution5.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a.d.ts +declare module "a" { + var x: number; +} + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution6.ts b/tests/cases/compiler/nodeResolution6.ts new file mode 100644 index 00000000000..3f6dc81c847 --- /dev/null +++ b/tests/cases/compiler/nodeResolution6.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/ref.ts +var x = 1; + +// @filename: node_modules/a.d.ts +/// +export declare var y; + + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution7.ts b/tests/cases/compiler/nodeResolution7.ts new file mode 100644 index 00000000000..b4283edb76a --- /dev/null +++ b/tests/cases/compiler/nodeResolution7.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a/index.d.ts +declare module "a" { + var x: number; +} + +// @filename: b.ts +import y = require("a"); diff --git a/tests/cases/compiler/nodeResolution8.ts b/tests/cases/compiler/nodeResolution8.ts new file mode 100644 index 00000000000..0a6e528f20a --- /dev/null +++ b/tests/cases/compiler/nodeResolution8.ts @@ -0,0 +1,13 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a/ref.ts +var x = 1; + +// @filename: node_modules/a/index.d.ts +/// +export declare var y; + + +// @filename: b.ts +import y = require("a"); \ No newline at end of file diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 0917e72f1ce..ab12119ec5a 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -40,8 +40,9 @@ module ts { let containingFile = { name: containingFileName } let moduleFile = { name: moduleFileNameNoExt + ext } let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); + let failedLookupLocations: string[] = []; let dir = getDirectoryPath(containingFileName); for (let e of supportedExtensions) { @@ -78,7 +79,8 @@ module ts { let packageJson = { name: packageJsonFileName, content: JSON.stringify({ "typings": fieldRef }) }; let moduleFile = { name: moduleFileName }; let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); // expect three failed lookup location - attempt to load module as file with all supported extensions assert.equal(resolution.failedLookupLocations.length, 3); } @@ -95,7 +97,8 @@ module ts { let packageJson = {name: "/a/b/foo/package.json", content: JSON.stringify({main: "/c/d"})}; let indexFile = { name: "/a/b/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("./foo", containingFile.name, createModuleResolutionHost(containingFile, packageJson, indexFile)); - assert.equal(resolution.resolvedFileName, indexFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, indexFile.name); + assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); assert.deepEqual(resolution.failedLookupLocations, [ "/a/b/foo.ts", "/a/b/foo.tsx", @@ -111,7 +114,7 @@ module ts { let containingFile = { name: "/a/b/c/d/e.ts" }; let moduleFile = { name: "/a/b/node_modules/foo.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, undefined); + assert.equal(resolution.resolvedModule, undefined); assert.deepEqual(resolution.failedLookupLocations, [ "/a/b/c/d/node_modules/foo.d.ts", "/a/b/c/d/node_modules/foo/package.json", @@ -135,14 +138,16 @@ module ts { let containingFile = { name: "/a/b/c/d/e.ts" }; let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.shouldBeProperExternalModule, true); }); it("load module as directory", () => { let containingFile = { name: "/a/node_modules/b/c/node_modules/d/e.ts" }; let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); + assert.equal(resolution.resolvedModule.shouldBeProperExternalModule, true); assert.deepEqual(resolution.failedLookupLocations, [ "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", @@ -158,64 +163,4 @@ module ts { ]); }); }); - - describe("BaseUrl mode", () => { - - it ("load module as relative url", () => { - function test(containingFileName: string, moduleFileName: string, moduleName: string): void { - let containingFile = {name: containingFileName }; - let moduleFile = { name: moduleFileName }; - let resolution = baseUrlModuleNameResolver(moduleName, containingFile.name, "", createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - let expectedFailedLookupLocations: string[] = []; - - let moduleNameHasExt = forEach(supportedExtensions, e => fileExtensionIs(moduleName, e)); - if (!moduleNameHasExt) { - let dir = getDirectoryPath(containingFileName); - - // add candidates with extensions that precede extension of the actual module name file in the list of supportd extensions - for (let ext of supportedExtensions) { - - let hasExtension = ext !== ".ts" - ? fileExtensionIs(moduleFileName, ext) - : fileExtensionIs(moduleFileName, ".ts") && !fileExtensionIs(moduleFileName, ".d.ts"); - - if (hasExtension) { - break; - } - else { - expectedFailedLookupLocations.push(normalizePath(combinePaths(dir, moduleName + ext))); - } - } - } - - assert.deepEqual(resolution.failedLookupLocations, expectedFailedLookupLocations) - } - - test("/a/b/c/d.ts", "/foo.ts", "/foo"); - test("/a/b/c/d.ts", "/foo.d.ts", "/foo"); - test("/a/b/c/d.ts", "/foo.tsx", "/foo"); - - test("/a/b/c/d.ts", "/a/b/c/foo.ts", "./foo"); - test("/a/b/c/d.ts", "/a/b/c/foo.d.ts", "./foo"); - test("/a/b/c/d.ts", "/a/b/c/foo.tsx", "./foo"); - - test("/a/b/c/d.ts", "/a/b/foo.ts", "../foo"); - test("/a/b/c/d.ts", "/a/b/foo.d.ts", "../foo"); - test("/a/b/c/d.ts", "/a/b/foo.tsx", "../foo"); - }); - - it ("load module using base url", () => { - function test(containingFileName: string, moduleFileName: string, moduleName: string, baseUrl: string): void { - let containingFile = { name: containingFileName }; - let moduleFile = { name: moduleFileName }; - let resolution = baseUrlModuleNameResolver(moduleName, containingFileName, baseUrl, createModuleResolutionHost(containingFile, moduleFile)); - assert.equal(resolution.resolvedFileName, moduleFile.name); - } - - test("/a/base/c/d.ts", "/a/base/c/d/e.ts", "c/d/e", "/a/base"); - test("/a/base/c/d.ts", "/a/base/c/d/e.d.ts", "c/d/e", "/a/base"); - test("/a/base/c/d.ts", "/a/base/c/d/e.tsx", "c/d/e", "/a/base"); - }); - }); } \ No newline at end of file diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 56b1dedbcbb..4d167cb1bb0 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -160,7 +160,7 @@ module ts { return size; } - function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { let file = program.getSourceFile(fileName); assert.isTrue(file !== undefined, `cannot find file ${fileName}`); if (expectedContent === undefined) { @@ -175,7 +175,16 @@ module ts { for (let id in expectedContent) { if (hasProperty(expectedContent, id)) { assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`); - assert.isTrue(expectedContent[id] === file.resolvedModules[id], `expected '${expectedContent[id]}' to be equal to '${file.resolvedModules[id]}'`); + if (expectedContent[id]) { + const expected = expectedContent[id]; + const actual = file.resolvedModules[id]; + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.shouldBeProperExternalModule === actual.shouldBeProperExternalModule, `'shouldBeProperExternalModule': expected '${expected.shouldBeProperExternalModule}' to be equal to '${actual.shouldBeProperExternalModule}'`); + } + else { + assert.isTrue(file.resolvedModules[id] === undefined); + } } } } @@ -237,7 +246,7 @@ module ts { var options: CompilerOptions = { target }; var program_1 = newProgram(files, ["a.ts"], options); - checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "a.ts", { "b": { resolvedFileName: "b.ts" } }); checkResolvedModulesCache(program_1, "b.ts", undefined); var program_2 = updateProgram(program_1, ["a.ts"], options, files => { @@ -246,7 +255,7 @@ module ts { assert.isTrue(program_1.structureIsReused); // content of resolution cache should not change - checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "a.ts", { "b": { resolvedFileName: "b.ts" } }); checkResolvedModulesCache(program_1, "b.ts", undefined); // imports has changed - program is not reused @@ -263,7 +272,7 @@ module ts { files[0].text = files[0].text.updateImportsAndExports(newImports); }); assert.isTrue(!program_3.structureIsReused); - checkResolvedModulesCache(program_4, "a.ts", { "b": "b.ts", "c": undefined }); + checkResolvedModulesCache(program_4, "a.ts", { "b": { resolvedFileName: "b.ts" }, "c": undefined }); }); }) } \ No newline at end of file From 031fdf19e03af0a29b200bda58420942bcaa379e Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 10 Sep 2015 16:42:02 -0700 Subject: [PATCH 30/75] addressed PR feedback --- src/compiler/diagnosticInformationMap.generated.ts | 4 ++-- src/compiler/diagnosticMessages.json | 4 ++-- src/compiler/program.ts | 12 ++++++------ src/compiler/types.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2b67d676d51..1ff650a399f 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -427,8 +427,8 @@ namespace ts { Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, - Proper_external_module_that_carries_external_typings_cannot_contain_tripleslash_references: { code: 2654, category: DiagnosticCategory.Error, key: "Proper external module that carries external typings cannot contain tripleslash references." }, - Proper_external_module_that_carries_external_typings_should_be_d_ts_file: { code: 2655, category: DiagnosticCategory.Error, key: "Proper external module that carries external typings should be '.d.ts' file." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index ad82541ad79..2fdf5869d1a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1697,11 +1697,11 @@ "category": "Error", "code": 2652 }, - "Proper external module that carries external typings cannot contain tripleslash references.": { + "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { "category": "Error", "code": 2654 }, - "Proper external module that carries external typings should be '.d.ts' file.": { + "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": { "category": "Error", "code": 2655 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f6931aea545..dba608c2ebc 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -129,12 +129,12 @@ namespace ts { let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedModule: { resolvedFileName: result, shouldBeProperExternalModule: true }, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedModule: { resolvedFileName: result, shouldBeProperExternalModule: true }, failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations }; } } @@ -475,7 +475,7 @@ namespace ts { let resolutionChanged = oldResolution ? !newResolution || oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.shouldBeProperExternalModule !== !!newResolution.shouldBeProperExternalModule + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport : newResolution; if (resolutionChanged) { @@ -860,18 +860,18 @@ namespace ts { setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); - if (importedFile && resolution.shouldBeProperExternalModule) { + if (importedFile && resolution.isExternalLibraryImport) { if (!isExternalModule(importedFile)) { let start = getTokenPosOfNode(file.imports[i], file) diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.File_0_is_not_a_module, importedFile.fileName)); } else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) { let start = getTokenPosOfNode(file.imports[i], file) - diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Proper_external_module_that_carries_external_typings_should_be_d_ts_file)); + diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); } else if (importedFile.referencedFiles.length) { let firstRef = importedFile.referencedFiles[0]; - diagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Proper_external_module_that_carries_external_typings_cannot_contain_tripleslash_references)); + diagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); } } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 191d723afa2..880feb0bf73 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2284,12 +2284,12 @@ namespace ts { export interface ResolvedModule { resolvedFileName: string; /* - * Denotes if 'resolvedFileName' should be proper external module: + * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be proper external module: * - be a .d.ts file * - use top level imports\exports * - don't use tripleslash references */ - shouldBeProperExternalModule?: boolean; + isExternalLibraryImport?: boolean; } export interface ResolvedModuleWithFailedLookupLocations { From a880be1f7555d0b2ad167fd3f18e2d4d665c5cae Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 10 Sep 2015 17:00:29 -0700 Subject: [PATCH 31/75] resolve merge conflicts, update tests --- src/compiler/program.ts | 6 +++--- tests/baselines/reference/nodeResolution6.errors.txt | 4 ++-- tests/baselines/reference/nodeResolution8.errors.txt | 4 ++-- tests/cases/unittests/moduleResolution.ts | 10 +++++----- tests/cases/unittests/reuseProgramStructure.ts | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index dba608c2ebc..0acb81f1908 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -863,15 +863,15 @@ namespace ts { if (importedFile && resolution.isExternalLibraryImport) { if (!isExternalModule(importedFile)) { let start = getTokenPosOfNode(file.imports[i], file) - diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.File_0_is_not_a_module, importedFile.fileName)); } else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) { let start = getTokenPosOfNode(file.imports[i], file) - diagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); } else if (importedFile.referencedFiles.length) { let firstRef = importedFile.referencedFiles[0]; - diagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); } } } diff --git a/tests/baselines/reference/nodeResolution6.errors.txt b/tests/baselines/reference/nodeResolution6.errors.txt index 8a462043207..6bab6e34389 100644 --- a/tests/baselines/reference/nodeResolution6.errors.txt +++ b/tests/baselines/reference/nodeResolution6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Proper external module that carries external typings cannot contain tripleslash references. +tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. ==== tests/cases/compiler/b.ts (0 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/node_modules/a.d.ts(1,1): error TS2654: Proper external mod ==== tests/cases/compiler/node_modules/a.d.ts (1 errors) ==== /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2654: Proper external module that carries external typings cannot contain tripleslash references. +!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. export declare var y; \ No newline at end of file diff --git a/tests/baselines/reference/nodeResolution8.errors.txt b/tests/baselines/reference/nodeResolution8.errors.txt index 82753a2049b..3f14a4313c8 100644 --- a/tests/baselines/reference/nodeResolution8.errors.txt +++ b/tests/baselines/reference/nodeResolution8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Proper external module that carries external typings cannot contain tripleslash references. +tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. ==== tests/cases/compiler/b.ts (0 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/node_modules/a/index.d.ts(1,1): error TS2654: Proper extern ==== tests/cases/compiler/node_modules/a/index.d.ts (1 errors) ==== /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2654: Proper external module that carries external typings cannot contain tripleslash references. +!!! error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition. export declare var y; \ No newline at end of file diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index ab12119ec5a..ed9f0b0a986 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -41,7 +41,7 @@ module ts { let moduleFile = { name: moduleFileNameNoExt + ext } let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); let failedLookupLocations: string[] = []; let dir = getDirectoryPath(containingFileName); @@ -80,7 +80,7 @@ module ts { let moduleFile = { name: moduleFileName }; let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); // expect three failed lookup location - attempt to load module as file with all supported extensions assert.equal(resolution.failedLookupLocations.length, 3); } @@ -98,7 +98,7 @@ module ts { let indexFile = { name: "/a/b/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("./foo", containingFile.name, createModuleResolutionHost(containingFile, packageJson, indexFile)); assert.equal(resolution.resolvedModule.resolvedFileName, indexFile.name); - assert.equal(!!resolution.resolvedModule.shouldBeProperExternalModule, false); + assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false); assert.deepEqual(resolution.failedLookupLocations, [ "/a/b/foo.ts", "/a/b/foo.tsx", @@ -139,7 +139,7 @@ module ts { let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(resolution.resolvedModule.shouldBeProperExternalModule, true); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); }); it("load module as directory", () => { @@ -147,7 +147,7 @@ module ts { let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name); - assert.equal(resolution.resolvedModule.shouldBeProperExternalModule, true); + assert.equal(resolution.resolvedModule.isExternalLibraryImport, true); assert.deepEqual(resolution.failedLookupLocations, [ "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 4d167cb1bb0..5f313eeae2b 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -180,7 +180,7 @@ module ts { const actual = file.resolvedModules[id]; assert.isTrue(actual !== undefined); assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); - assert.isTrue(expected.shouldBeProperExternalModule === actual.shouldBeProperExternalModule, `'shouldBeProperExternalModule': expected '${expected.shouldBeProperExternalModule}' to be equal to '${actual.shouldBeProperExternalModule}'`); + assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'shouldBeProperExternalModule': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); } else { assert.isTrue(file.resolvedModules[id] === undefined); From 0e5196180e03c66f92efd0713d8b4a00aea81f55 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 11 Sep 2015 09:36:17 -0700 Subject: [PATCH 32/75] emit export specifiers in system modules only if export has a value side --- src/compiler/emitter.ts | 6 +- tests/baselines/reference/systemModule17.js | 84 ++++++++++++++++ .../reference/systemModule17.symbols | 93 ++++++++++++++++++ .../baselines/reference/systemModule17.types | 95 +++++++++++++++++++ tests/cases/compiler/systemModule17.ts | 41 ++++++++ 5 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/systemModule17.js create mode 100644 tests/baselines/reference/systemModule17.symbols create mode 100644 tests/baselines/reference/systemModule17.types create mode 100644 tests/cases/compiler/systemModule17.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 2d5bda1bba2..a5c9b88b7dd 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3144,6 +3144,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void { Debug.assert(compilerOptions.module === ModuleKind.System); + + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) { + return; + } writeLine(); emitStart(specifier.name); @@ -6106,7 +6110,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return; } - if (isInternalModuleImportEqualsDeclaration(node)) { + if (isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } diff --git a/tests/baselines/reference/systemModule17.js b/tests/baselines/reference/systemModule17.js new file mode 100644 index 00000000000..90efdc8872a --- /dev/null +++ b/tests/baselines/reference/systemModule17.js @@ -0,0 +1,84 @@ +//// [tests/cases/compiler/systemModule17.ts] //// + +//// [f1.ts] + + +export class A {} +export interface I {} + +//// [f2.ts] + +var x = 1; +interface I { } + +namespace N { + export var x = 1; + export interface I { } +} + +import IX = N.x; +import II = N.I; +import { A, A as EA, I as EI } from "f1"; + +export {x}; +export {x as x1}; + +export {I}; +export {I as I1}; + +export {A}; +export {A as A1}; + +export {EA}; +export {EA as EA1}; + +export {EI }; +export {EI as EI1}; + +export {IX}; +export {IX as IX1}; + +export {II}; +export {II as II1}; + +//// [f1.js] +System.register([], function(exports_1) { + var A; + return { + setters:[], + execute: function() { + A = (function () { + function A() { + } + return A; + })(); + exports_1("A", A); + } + } +}); +//// [f2.js] +System.register(["f1"], function(exports_1) { + var f1_1; + var x, N, IX; + return { + setters:[ + function (f1_1_1) { + f1_1 = f1_1_1; + }], + execute: function() { + x = 1; + (function (N) { + N.x = 1; + })(N || (N = {})); + IX = N.x; + exports_1("x", x); + exports_1("x1", x); + exports_1("A", f1_1.A); + exports_1("A1", f1_1.A); + exports_1("EA", f1_1.A); + exports_1("EA1", f1_1.A); + exports_1("IX", IX); + exports_1("IX1", IX); + } + } +}); diff --git a/tests/baselines/reference/systemModule17.symbols b/tests/baselines/reference/systemModule17.symbols new file mode 100644 index 00000000000..3bf19dad950 --- /dev/null +++ b/tests/baselines/reference/systemModule17.symbols @@ -0,0 +1,93 @@ +=== tests/cases/compiler/f1.ts === + + +export class A {} +>A : Symbol(A, Decl(f1.ts, 0, 0)) + +export interface I {} +>I : Symbol(I, Decl(f1.ts, 2, 17)) + +=== tests/cases/compiler/f2.ts === + +var x = 1; +>x : Symbol(x, Decl(f2.ts, 1, 3)) + +interface I { } +>I : Symbol(I, Decl(f2.ts, 1, 10)) + +namespace N { +>N : Symbol(N, Decl(f2.ts, 2, 15)) + + export var x = 1; +>x : Symbol(x, Decl(f2.ts, 5, 11)) + + export interface I { } +>I : Symbol(I, Decl(f2.ts, 5, 18)) +} + +import IX = N.x; +>IX : Symbol(IX, Decl(f2.ts, 7, 1)) +>N : Symbol(N, Decl(f2.ts, 2, 15)) +>x : Symbol(IX, Decl(f2.ts, 5, 11)) + +import II = N.I; +>II : Symbol(II, Decl(f2.ts, 9, 16)) +>N : Symbol(N, Decl(f2.ts, 2, 15)) +>I : Symbol(II, Decl(f2.ts, 5, 18)) + +import { A, A as EA, I as EI } from "f1"; +>A : Symbol(A, Decl(f2.ts, 11, 8)) +>A : Symbol(EA, Decl(f2.ts, 11, 11)) +>EA : Symbol(EA, Decl(f2.ts, 11, 11)) +>I : Symbol(EI, Decl(f2.ts, 11, 20)) +>EI : Symbol(EI, Decl(f2.ts, 11, 20)) + +export {x}; +>x : Symbol(x, Decl(f2.ts, 13, 8)) + +export {x as x1}; +>x : Symbol(x1, Decl(f2.ts, 14, 8)) +>x1 : Symbol(x1, Decl(f2.ts, 14, 8)) + +export {I}; +>I : Symbol(I, Decl(f2.ts, 16, 8)) + +export {I as I1}; +>I : Symbol(I1, Decl(f2.ts, 17, 8)) +>I1 : Symbol(I1, Decl(f2.ts, 17, 8)) + +export {A}; +>A : Symbol(A, Decl(f2.ts, 19, 8)) + +export {A as A1}; +>A : Symbol(A1, Decl(f2.ts, 20, 8)) +>A1 : Symbol(A1, Decl(f2.ts, 20, 8)) + +export {EA}; +>EA : Symbol(EA, Decl(f2.ts, 22, 8)) + +export {EA as EA1}; +>EA : Symbol(EA1, Decl(f2.ts, 23, 8)) +>EA1 : Symbol(EA1, Decl(f2.ts, 23, 8)) + +export {EI }; +>EI : Symbol(EI, Decl(f2.ts, 25, 8)) + +export {EI as EI1}; +>EI : Symbol(EI1, Decl(f2.ts, 26, 8)) +>EI1 : Symbol(EI1, Decl(f2.ts, 26, 8)) + +export {IX}; +>IX : Symbol(IX, Decl(f2.ts, 28, 8)) + +export {IX as IX1}; +>IX : Symbol(IX1, Decl(f2.ts, 29, 8)) +>IX1 : Symbol(IX1, Decl(f2.ts, 29, 8)) + +export {II}; +>II : Symbol(II, Decl(f2.ts, 31, 8)) + +export {II as II1}; +>II : Symbol(II1, Decl(f2.ts, 32, 8)) +>II1 : Symbol(II1, Decl(f2.ts, 32, 8)) + diff --git a/tests/baselines/reference/systemModule17.types b/tests/baselines/reference/systemModule17.types new file mode 100644 index 00000000000..1f0b1b51842 --- /dev/null +++ b/tests/baselines/reference/systemModule17.types @@ -0,0 +1,95 @@ +=== tests/cases/compiler/f1.ts === + + +export class A {} +>A : A + +export interface I {} +>I : I + +=== tests/cases/compiler/f2.ts === + +var x = 1; +>x : number +>1 : number + +interface I { } +>I : I + +namespace N { +>N : typeof N + + export var x = 1; +>x : number +>1 : number + + export interface I { } +>I : I +} + +import IX = N.x; +>IX : number +>N : typeof N +>x : number + +import II = N.I; +>II : any +>N : typeof N +>I : II + +import { A, A as EA, I as EI } from "f1"; +>A : typeof A +>A : typeof A +>EA : typeof A +>I : any +>EI : any + +export {x}; +>x : number + +export {x as x1}; +>x : number +>x1 : number + +export {I}; +>I : any + +export {I as I1}; +>I : any +>I1 : any + +export {A}; +>A : typeof A + +export {A as A1}; +>A : typeof A +>A1 : typeof A + +export {EA}; +>EA : typeof A + +export {EA as EA1}; +>EA : typeof A +>EA1 : typeof A + +export {EI }; +>EI : any + +export {EI as EI1}; +>EI : any +>EI1 : any + +export {IX}; +>IX : number + +export {IX as IX1}; +>IX : number +>IX1 : number + +export {II}; +>II : any + +export {II as II1}; +>II : any +>II1 : any + diff --git a/tests/cases/compiler/systemModule17.ts b/tests/cases/compiler/systemModule17.ts new file mode 100644 index 00000000000..f6b6d6ea2f2 --- /dev/null +++ b/tests/cases/compiler/systemModule17.ts @@ -0,0 +1,41 @@ +// @module: system + +// @filename: f1.ts + +export class A {} +export interface I {} + +// @filename: f2.ts + +var x = 1; +interface I { } + +namespace N { + export var x = 1; + export interface I { } +} + +import IX = N.x; +import II = N.I; +import { A, A as EA, I as EI } from "f1"; + +export {x}; +export {x as x1}; + +export {I}; +export {I as I1}; + +export {A}; +export {A as A1}; + +export {EA}; +export {EA as EA1}; + +export {EI }; +export {EI as EI1}; + +export {IX}; +export {IX as IX1}; + +export {II}; +export {II as II1}; \ No newline at end of file From a44d8e76c68e7c685cef3d34943158021acd04e5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 11 Sep 2015 11:32:35 -0700 Subject: [PATCH 33/75] Update LKG --- lib/tsc.js | 192 ++++++++++++++++++------------- lib/tsserver.js | 219 +++++++++++++++++++++--------------- lib/typescript.d.ts | 16 +-- lib/typescript.js | 213 ++++++++++++++++++++--------------- lib/typescriptServices.d.ts | 16 +-- lib/typescriptServices.js | 213 ++++++++++++++++++++--------------- 6 files changed, 505 insertions(+), 364 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 019ef143cc8..a98799b1d86 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1431,6 +1431,8 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3760,21 +3762,21 @@ var ts; return true; } ts.arrayIsEqualTo = arrayIsEqualTo; - function hasResolvedModuleName(sourceFile, moduleNameText) { + function hasResolvedModule(sourceFile, moduleNameText) { return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); } - ts.hasResolvedModuleName = hasResolvedModuleName; - function getResolvedModuleFileName(sourceFile, moduleNameText) { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - ts.getResolvedModuleFileName = getResolvedModuleFileName; - function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } - ts.setResolvedModuleName = setResolvedModuleName; + ts.setResolvedModule = setResolvedModule; function containsParseError(node) { aggregateChildData(node); return (node.parserContextFlags & 64) !== 0; @@ -4976,11 +4978,21 @@ var ts; add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + function reattachFileDiagnostics(newFile) { + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; + } + } function add(diagnostic) { var diagnostics; if (diagnostic.file) { @@ -10966,8 +10978,8 @@ var ts; return symbol; } } - var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - var sourceFile = fileName && host.getSourceFile(fileName); + var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -25985,6 +25997,9 @@ var ts; } function emitExportSpecifierInSystemModule(specifier) { ts.Debug.assert(compilerOptions.module === 4); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } writeLine(); emitStart(specifier.name); write(exportFunctionForFile + "(\""); @@ -28253,7 +28268,7 @@ var ts; } return; } - if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } @@ -29379,10 +29394,12 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host); - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -29440,11 +29457,11 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } } var parentPath = ts.getDirectoryPath(directory); @@ -29453,36 +29470,15 @@ var ts; } directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } - function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) { - ts.Debug.assert(baseUrl !== undefined); - var normalizedModuleName = ts.normalizeSlashes(moduleName); - var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile); - var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName)); - var failedLookupLocations = []; - return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; - function tryLoadFile(location) { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations: failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } - } - ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver; function nameStartsWithDotSlashOrDotDotSlash(name) { var i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === 46); } - function useBaseUrl(moduleName) { - return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; @@ -29511,7 +29507,9 @@ var ts; } searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { @@ -29624,7 +29622,8 @@ var ts; function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var diagnostics = ts.createDiagnosticCollection(); + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; @@ -29632,8 +29631,9 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); - var resolveModuleNamesWorker = host.resolveModuleNames || - (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); + var resolveModuleNamesWorker = host.resolveModuleNames + ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) + : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); if (oldProgram) { var oldOptions = oldProgram.getCompilerOptions(); @@ -29673,7 +29673,8 @@ var ts; getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } }; return program; function getClassifiableNames() { @@ -29697,6 +29698,7 @@ var ts; return false; } var newSourceFiles = []; + var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); @@ -29718,13 +29720,20 @@ var ts; var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); for (var i = 0; i < moduleNames.length; ++i) { - var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + var newResolution = resolutions[i]; + var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); + var resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport + : newResolution; + if (resolutionChanged) { return false; } } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { newSourceFile = oldSourceFile; @@ -29736,6 +29745,11 @@ var ts; filesByName.set(file.fileName, file); } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _c = 0; _c < modifiedSourceFiles.length; _c++) { + var modifiedFile = modifiedSourceFiles[_c]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; } @@ -29817,8 +29831,9 @@ var ts; ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { @@ -29832,7 +29847,8 @@ var ts; } function getOptionsDiagnostics() { var allDiagnostics = []; - ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function getGlobalDiagnostics() { @@ -29922,10 +29938,10 @@ var ts; } if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } @@ -29942,10 +29958,10 @@ var ts; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -29973,10 +29989,10 @@ var ts; var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -29997,9 +30013,23 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (var i = 0; i < file.imports.length; ++i) { var resolution = resolutions[i]; - ts.setResolvedModuleName(file, moduleNames[i], resolution); + ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.isExternalLibraryImport) { + if (!ts.isExternalModule(importedFile)) { + var start_2 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + } + else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { + var start_3 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + } + else if (importedFile.referencedFiles.length) { + var firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } } } } @@ -30008,7 +30038,7 @@ var ts; } return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -30027,7 +30057,7 @@ var ts; for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } commonPathComponents.length = i; @@ -30050,7 +30080,7 @@ var ts; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -30061,43 +30091,43 @@ var ts; function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -30106,20 +30136,20 @@ var ts; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } if (options.outDir || options.sourceRoot || @@ -30137,25 +30167,25 @@ var ts; } if (options.noEmit) { if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } diff --git a/lib/tsserver.js b/lib/tsserver.js index fc5f34dec2a..ce095409d9a 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -1431,6 +1431,8 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3508,21 +3510,21 @@ var ts; return true; } ts.arrayIsEqualTo = arrayIsEqualTo; - function hasResolvedModuleName(sourceFile, moduleNameText) { + function hasResolvedModule(sourceFile, moduleNameText) { return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); } - ts.hasResolvedModuleName = hasResolvedModuleName; - function getResolvedModuleFileName(sourceFile, moduleNameText) { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - ts.getResolvedModuleFileName = getResolvedModuleFileName; - function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } - ts.setResolvedModuleName = setResolvedModuleName; + ts.setResolvedModule = setResolvedModule; function containsParseError(node) { aggregateChildData(node); return (node.parserContextFlags & 64) !== 0; @@ -4724,11 +4726,21 @@ var ts; add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + function reattachFileDiagnostics(newFile) { + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; + } + } function add(diagnostic) { var diagnostics; if (diagnostic.file) { @@ -11428,8 +11440,8 @@ var ts; return symbol; } } - var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - var sourceFile = fileName && host.getSourceFile(fileName); + var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -26447,6 +26459,9 @@ var ts; } function emitExportSpecifierInSystemModule(specifier) { ts.Debug.assert(compilerOptions.module === 4); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } writeLine(); emitStart(specifier.name); write(exportFunctionForFile + "(\""); @@ -28715,7 +28730,7 @@ var ts; } return; } - if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } @@ -29841,10 +29856,12 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host); - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -29902,11 +29919,11 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } } var parentPath = ts.getDirectoryPath(directory); @@ -29915,36 +29932,15 @@ var ts; } directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } - function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) { - ts.Debug.assert(baseUrl !== undefined); - var normalizedModuleName = ts.normalizeSlashes(moduleName); - var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile); - var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName)); - var failedLookupLocations = []; - return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; - function tryLoadFile(location) { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations: failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } - } - ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver; function nameStartsWithDotSlashOrDotDotSlash(name) { var i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === 46); } - function useBaseUrl(moduleName) { - return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; @@ -29973,7 +29969,9 @@ var ts; } searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } ts.classicNameResolver = classicNameResolver; ts.defaultInitCompilerOptions = { @@ -30086,7 +30084,8 @@ var ts; function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var diagnostics = ts.createDiagnosticCollection(); + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; @@ -30094,8 +30093,9 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); - var resolveModuleNamesWorker = host.resolveModuleNames || - (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); + var resolveModuleNamesWorker = host.resolveModuleNames + ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) + : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); if (oldProgram) { var oldOptions = oldProgram.getCompilerOptions(); @@ -30135,7 +30135,8 @@ var ts; getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } }; return program; function getClassifiableNames() { @@ -30159,6 +30160,7 @@ var ts; return false; } var newSourceFiles = []; + var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); @@ -30180,13 +30182,20 @@ var ts; var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); for (var i = 0; i < moduleNames.length; ++i) { - var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + var newResolution = resolutions[i]; + var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); + var resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport + : newResolution; + if (resolutionChanged) { return false; } } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { newSourceFile = oldSourceFile; @@ -30198,6 +30207,11 @@ var ts; filesByName.set(file.fileName, file); } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _c = 0; _c < modifiedSourceFiles.length; _c++) { + var modifiedFile = modifiedSourceFiles[_c]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; } @@ -30279,8 +30293,9 @@ var ts; ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { @@ -30294,7 +30309,8 @@ var ts; } function getOptionsDiagnostics() { var allDiagnostics = []; - ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function getGlobalDiagnostics() { @@ -30384,10 +30400,10 @@ var ts; } if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } @@ -30404,10 +30420,10 @@ var ts; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -30435,10 +30451,10 @@ var ts; var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -30459,9 +30475,23 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (var i = 0; i < file.imports.length; ++i) { var resolution = resolutions[i]; - ts.setResolvedModuleName(file, moduleNames[i], resolution); + ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.isExternalLibraryImport) { + if (!ts.isExternalModule(importedFile)) { + var start_2 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + } + else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { + var start_3 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + } + else if (importedFile.referencedFiles.length) { + var firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } } } } @@ -30470,7 +30500,7 @@ var ts; } return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -30489,7 +30519,7 @@ var ts; for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } commonPathComponents.length = i; @@ -30512,7 +30542,7 @@ var ts; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -30523,43 +30553,43 @@ var ts; function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -30568,20 +30598,20 @@ var ts; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } if (options.outDir || options.sourceRoot || @@ -30599,25 +30629,25 @@ var ts; } if (options.noEmit) { if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } @@ -37213,9 +37243,9 @@ var ts; log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start)); var contextToken = previousToken; if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_2 = new Date().getTime(); + var start_4 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4)); } var node = currentToken; var isRightOfDot = false; @@ -37410,9 +37440,9 @@ var ts; if (contextToken.kind === 9 || contextToken.kind === 10 || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_3 = contextToken.getStart(); + var start_5 = contextToken.getStart(); var end = contextToken.getEnd(); - if (start_3 < position && position < end) { + if (start_5 < position && position < end) { return true; } if (position === end) { @@ -41760,7 +41790,7 @@ var ts; LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { var currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); var newResolutions = {}; - var resolvedFileNames = []; + var resolvedModules = []; var compilerOptions = this.getCompilationSettings(); for (var _i = 0; _i < moduleNames.length; _i++) { var moduleName = moduleNames[_i]; @@ -41777,15 +41807,15 @@ var ts; } } ts.Debug.assert(resolution !== undefined); - resolvedFileNames.push(resolution.resolvedFileName); + resolvedModules.push(resolution.resolvedModule); } this.resolvedModuleNames.set(containingFile, newResolutions); - return resolvedFileNames; + return resolvedModules; function moduleResolutionIsValid(resolution) { if (!resolution) { return false; } - if (resolution.resolvedFileName) { + if (resolution.resolvedModule) { return true; } return resolution.failedLookupLocations.length === 0; @@ -43749,7 +43779,10 @@ var ts; if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = function (moduleNames, containingFile) { var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); - return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + return ts.map(moduleNames, function (name) { + var result = ts.lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); }; } } @@ -44224,7 +44257,11 @@ var ts; var _this = this; return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson); - return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + failedLookupLocations: result.failedLookupLocations + }; }); }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 5e6492cfe1e..ec4ccd15589 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -1382,9 +1382,12 @@ declare namespace ts { } interface ResolvedModule { resolvedFileName: string; + isExternalLibraryImport?: boolean; + } + interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModule; failedLookupLocations: string[]; } - type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; @@ -1394,7 +1397,7 @@ declare namespace ts { getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } interface TextSpan { start: number; @@ -1515,10 +1518,9 @@ declare namespace ts { const version: string; function findConfigFile(searchPath: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; - function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule; - function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; @@ -1649,7 +1651,7 @@ declare namespace ts { trace?(s: string): void; error?(s: string): void; useCaseSensitiveFileNames?(): boolean; - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } interface LanguageService { cleanupSemanticCache(): void; diff --git a/lib/typescript.js b/lib/typescript.js index f6701d019cc..ebc0ba70357 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -2300,6 +2300,8 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -5012,21 +5014,21 @@ var ts; return true; } ts.arrayIsEqualTo = arrayIsEqualTo; - function hasResolvedModuleName(sourceFile, moduleNameText) { + function hasResolvedModule(sourceFile, moduleNameText) { return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); } - ts.hasResolvedModuleName = hasResolvedModuleName; - function getResolvedModuleFileName(sourceFile, moduleNameText) { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - ts.getResolvedModuleFileName = getResolvedModuleFileName; - function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } - ts.setResolvedModuleName = setResolvedModuleName; + ts.setResolvedModule = setResolvedModule; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -6363,11 +6365,21 @@ var ts; add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + function reattachFileDiagnostics(newFile) { + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; + } + } function add(diagnostic) { var diagnostics; if (diagnostic.file) { @@ -13745,8 +13757,8 @@ var ts; return symbol; } } - var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - var sourceFile = fileName && host.getSourceFile(fileName); + var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -31225,6 +31237,9 @@ var ts; } function emitExportSpecifierInSystemModule(specifier) { ts.Debug.assert(compilerOptions.module === 4 /* System */); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } writeLine(); emitStart(specifier.name); write(exportFunctionForFile + "(\""); @@ -33896,7 +33911,7 @@ var ts; } return; } - if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } @@ -35164,10 +35179,12 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -35227,11 +35244,11 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } } var parentPath = ts.getDirectoryPath(directory); @@ -35240,39 +35257,16 @@ var ts; } directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } - function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) { - ts.Debug.assert(baseUrl !== undefined); - var normalizedModuleName = ts.normalizeSlashes(moduleName); - var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile); - var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName)); - var failedLookupLocations = []; - return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; - function tryLoadFile(location) { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations: failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } - } - ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver; function nameStartsWithDotSlashOrDotDotSlash(name) { var i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */); } - function useBaseUrl(moduleName) { - // path is not rooted - // module name does not start with './' or '../' - return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; @@ -35303,7 +35297,9 @@ var ts; } searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } ts.classicNameResolver = classicNameResolver; /* @internal */ @@ -35420,7 +35416,8 @@ var ts; function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var diagnostics = ts.createDiagnosticCollection(); + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; @@ -35428,8 +35425,9 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); - var resolveModuleNamesWorker = host.resolveModuleNames || - (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); + var resolveModuleNamesWorker = host.resolveModuleNames + ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) + : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); if (oldProgram) { // check properties that can affect structure of the program or module resolution strategy @@ -35476,7 +35474,8 @@ var ts; getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } }; return program; function getClassifiableNames() { @@ -35503,6 +35502,7 @@ var ts; } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; + var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); @@ -35531,14 +35531,21 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); // ensure that module resolution results are still correct for (var i = 0; i < moduleNames.length; ++i) { - var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + var newResolution = resolutions[i]; + var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); + var resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport + : newResolution; + if (resolutionChanged) { return false; } } } // pass the cache of module resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { // file has no changes - use it as is @@ -35553,6 +35560,11 @@ var ts; filesByName.set(file.fileName, file); } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _c = 0; _c < modifiedSourceFiles.length; _c++) { + var modifiedFile = modifiedSourceFiles[_c]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; } @@ -35654,8 +35666,9 @@ var ts; ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { @@ -35670,7 +35683,8 @@ var ts; } function getOptionsDiagnostics() { var allDiagnostics = []; - ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function getGlobalDiagnostics() { @@ -35768,10 +35782,10 @@ var ts; } if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } @@ -35791,10 +35805,10 @@ var ts; // We haven't looked for this file, do so now and cache result var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -35824,10 +35838,10 @@ var ts; var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -35848,9 +35862,23 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (var i = 0; i < file.imports.length; ++i) { var resolution = resolutions[i]; - ts.setResolvedModuleName(file, moduleNames[i], resolution); + ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.isExternalLibraryImport) { + if (!ts.isExternalModule(importedFile)) { + var start_2 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + } + else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { + var start_3 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + } + else if (importedFile.referencedFiles.length) { + var firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } } } } @@ -35860,7 +35888,7 @@ var ts; } return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -35881,7 +35909,7 @@ var ts; for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } // New common path found that is 0 -> i-1 @@ -35906,7 +35934,7 @@ var ts; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -35917,44 +35945,44 @@ var ts; function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -35963,22 +35991,22 @@ var ts; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -36003,25 +36031,25 @@ var ts; } if (options.noEmit) { if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } @@ -44003,9 +44031,9 @@ var ts; // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier and adjust the contextToken to the token that precedes it. if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_2 = new Date().getTime(); + var start_4 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4)); } // Find the node where completion is requested on. // Also determine whether we are trying to complete with members of that node @@ -44253,13 +44281,13 @@ var ts; if (contextToken.kind === 9 /* StringLiteral */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_3 = contextToken.getStart(); + var start_5 = contextToken.getStart(); var end = contextToken.getEnd(); // To be "in" one of these literals, the position has to be: // 1. entirely within the token text. // 2. at the end position of an unterminated token. // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start_3 < position && position < end) { + if (start_5 < position && position < end) { return true; } if (position === end) { @@ -48631,7 +48659,10 @@ var ts; if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = function (moduleNames, containingFile) { var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); - return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + return ts.map(moduleNames, function (name) { + var result = ts.lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); }; } } @@ -49178,7 +49209,11 @@ var ts; var _this = this; return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson); - return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + failedLookupLocations: result.failedLookupLocations + }; }); }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 3d4418a9750..4ce3cd34cb5 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -1382,9 +1382,12 @@ declare namespace ts { } interface ResolvedModule { resolvedFileName: string; + isExternalLibraryImport?: boolean; + } + interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModule; failedLookupLocations: string[]; } - type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; @@ -1394,7 +1397,7 @@ declare namespace ts { getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } interface TextSpan { start: number; @@ -1515,10 +1518,9 @@ declare namespace ts { const version: string; function findConfigFile(searchPath: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; - function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule; - function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; @@ -1649,7 +1651,7 @@ declare namespace ts { trace?(s: string): void; error?(s: string): void; useCaseSensitiveFileNames?(): boolean; - resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; } interface LanguageService { cleanupSemanticCache(): void; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index f6701d019cc..ebc0ba70357 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -2300,6 +2300,8 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, + Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -5012,21 +5014,21 @@ var ts; return true; } ts.arrayIsEqualTo = arrayIsEqualTo; - function hasResolvedModuleName(sourceFile, moduleNameText) { + function hasResolvedModule(sourceFile, moduleNameText) { return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); } - ts.hasResolvedModuleName = hasResolvedModuleName; - function getResolvedModuleFileName(sourceFile, moduleNameText) { - return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; } - ts.getResolvedModuleFileName = getResolvedModuleFileName; - function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = {}; } - sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + sourceFile.resolvedModules[moduleNameText] = resolvedModule; } - ts.setResolvedModuleName = setResolvedModuleName; + ts.setResolvedModule = setResolvedModule; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -6363,11 +6365,21 @@ var ts; add: add, getGlobalDiagnostics: getGlobalDiagnostics, getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics }; function getModificationCount() { return modificationCount; } + function reattachFileDiagnostics(newFile) { + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; + } + } function add(diagnostic) { var diagnostics; if (diagnostic.file) { @@ -13745,8 +13757,8 @@ var ts; return symbol; } } - var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); - var sourceFile = fileName && host.getSourceFile(fileName); + var resolvedModule = ts.getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -31225,6 +31237,9 @@ var ts; } function emitExportSpecifierInSystemModule(specifier) { ts.Debug.assert(compilerOptions.module === 4 /* System */); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } writeLine(); emitStart(specifier.name); write(exportFunctionForFile + "(\""); @@ -33896,7 +33911,7 @@ var ts; } return; } - if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; } @@ -35164,10 +35179,12 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); if (resolvedFileName) { - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); - return { resolvedFileName: resolvedFileName, failedLookupLocations: failedLookupLocations }; + return resolvedFileName + ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } else { return loadModuleFromNodeModules(moduleName, containingDirectory, host); @@ -35227,11 +35244,11 @@ var ts; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); var result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); if (result) { - return { resolvedFileName: result, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } } var parentPath = ts.getDirectoryPath(directory); @@ -35240,39 +35257,16 @@ var ts; } directory = parentPath; } - return { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } - function baseUrlModuleNameResolver(moduleName, containingFile, baseUrl, host) { - ts.Debug.assert(baseUrl !== undefined); - var normalizedModuleName = ts.normalizeSlashes(moduleName); - var basePart = useBaseUrl(moduleName) ? baseUrl : ts.getDirectoryPath(containingFile); - var candidate = ts.normalizePath(ts.combinePaths(basePart, moduleName)); - var failedLookupLocations = []; - return ts.forEach(ts.supportedExtensions, function (ext) { return tryLoadFile(candidate + ext); }) || { resolvedFileName: undefined, failedLookupLocations: failedLookupLocations }; - function tryLoadFile(location) { - if (host.fileExists(location)) { - return { resolvedFileName: location, failedLookupLocations: failedLookupLocations }; - } - else { - failedLookupLocations.push(location); - return undefined; - } - } - } - ts.baseUrlModuleNameResolver = baseUrlModuleNameResolver; function nameStartsWithDotSlashOrDotDotSlash(name) { var i = name.lastIndexOf("./", 1); return i === 0 || (i === 1 && name.charCodeAt(0) === 46 /* dot */); } - function useBaseUrl(moduleName) { - // path is not rooted - // module name does not start with './' or '../' - return ts.getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); - } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { // module names that contain '!' are used to reference resources and are not resolved to actual files on disk if (moduleName.indexOf('!') != -1) { - return { resolvedFileName: undefined, failedLookupLocations: [] }; + return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); var searchName; @@ -35303,7 +35297,9 @@ var ts; } searchPath = parentPath; } - return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + return referencedSourceFile + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } + : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; } ts.classicNameResolver = classicNameResolver; /* @internal */ @@ -35420,7 +35416,8 @@ var ts; function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var diagnostics = ts.createDiagnosticCollection(); + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; @@ -35428,8 +35425,9 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); - var resolveModuleNamesWorker = host.resolveModuleNames || - (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); + var resolveModuleNamesWorker = host.resolveModuleNames + ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) + : (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); if (oldProgram) { // check properties that can affect structure of the program or module resolution strategy @@ -35476,7 +35474,8 @@ var ts; getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } }; return program; function getClassifiableNames() { @@ -35503,6 +35502,7 @@ var ts; } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; + var modifiedSourceFiles = []; for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var oldSourceFile = _a[_i]; var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); @@ -35531,14 +35531,21 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); // ensure that module resolution results are still correct for (var i = 0; i < moduleNames.length; ++i) { - var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); - if (oldResolution !== resolutions[i]) { + var newResolution = resolutions[i]; + var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); + var resolutionChanged = oldResolution + ? !newResolution || + oldResolution.resolvedFileName !== newResolution.resolvedFileName || + !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport + : newResolution; + if (resolutionChanged) { return false; } } } // pass the cache of module resolutions from the old source file newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + modifiedSourceFiles.push(newSourceFile); } else { // file has no changes - use it as is @@ -35553,6 +35560,11 @@ var ts; filesByName.set(file.fileName, file); } files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _c = 0; _c < modifiedSourceFiles.length; _c++) { + var modifiedFile = modifiedSourceFiles[_c]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + } oldProgram.structureIsReused = true; return true; } @@ -35654,8 +35666,9 @@ var ts; ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; var checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken); - var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); }); } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { @@ -35670,7 +35683,8 @@ var ts; } function getOptionsDiagnostics() { var allDiagnostics = []; - ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function getGlobalDiagnostics() { @@ -35768,10 +35782,10 @@ var ts; } if (diagnostic) { if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { - diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } @@ -35791,10 +35805,10 @@ var ts; // We haven't looked for this file, do so now and cache result var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); filesByName.set(canonicalName, file); @@ -35824,10 +35838,10 @@ var ts; var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } else { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } } @@ -35848,9 +35862,23 @@ var ts; var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); for (var i = 0; i < file.imports.length; ++i) { var resolution = resolutions[i]; - ts.setResolvedModuleName(file, moduleNames[i], resolution); + ts.setResolvedModule(file, moduleNames[i], resolution); if (resolution && !options.noResolve) { - findModuleSourceFile(resolution, file.imports[i]); + var importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); + if (importedFile && resolution.isExternalLibraryImport) { + if (!ts.isExternalModule(importedFile)) { + var start_2 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + } + else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { + var start_3 = ts.getTokenPosOfNode(file.imports[i], file); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + } + else if (importedFile.referencedFiles.length) { + var firstRef = importedFile.referencedFiles[0]; + fileProcessingDiagnostics.add(ts.createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, ts.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition)); + } + } } } } @@ -35860,7 +35888,7 @@ var ts; } return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); + return findSourceFile(fileName, /* isDefaultLib */ false, file, ts.skipTrivia(file.text, nameLiteral.pos), nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -35881,7 +35909,7 @@ var ts; for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } // New common path found that is 0 -> i-1 @@ -35906,7 +35934,7 @@ var ts; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); allFilesBelongToPath = false; } } @@ -35917,44 +35945,44 @@ var ts; function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { if (!options.sourceMap && !options.inlineSourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } if (options.out && options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } @@ -35963,22 +35991,22 @@ var ts; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -36003,25 +36031,25 @@ var ts; } if (options.noEmit) { if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); } if (options.outFile) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); } if (options.outDir) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); } } } @@ -44003,9 +44031,9 @@ var ts; // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier and adjust the contextToken to the token that precedes it. if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_2 = new Date().getTime(); + var start_4 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_2)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4)); } // Find the node where completion is requested on. // Also determine whether we are trying to complete with members of that node @@ -44253,13 +44281,13 @@ var ts; if (contextToken.kind === 9 /* StringLiteral */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_3 = contextToken.getStart(); + var start_5 = contextToken.getStart(); var end = contextToken.getEnd(); // To be "in" one of these literals, the position has to be: // 1. entirely within the token text. // 2. at the end position of an unterminated token. // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start_3 < position && position < end) { + if (start_5 < position && position < end) { return true; } if (position === end) { @@ -48631,7 +48659,10 @@ var ts; if ("getModuleResolutionsForFile" in this.shimHost) { this.resolveModuleNames = function (moduleNames, containingFile) { var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); - return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + return ts.map(moduleNames, function (name) { + var result = ts.lookUp(resolutionsInFile, name); + return result ? { resolvedFileName: result } : undefined; + }); }; } } @@ -49178,7 +49209,11 @@ var ts; var _this = this; return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson); - return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + failedLookupLocations: result.failedLookupLocations + }; }); }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { From 62b9b556c8da6539bcea48dfe6adac875559c1d0 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 12 Sep 2015 05:21:08 -0700 Subject: [PATCH 34/75] use sting templates --- src/harness/instrumenter.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/harness/instrumenter.ts b/src/harness/instrumenter.ts index 1c9b9af78d2..b1b1750b8a8 100644 --- a/src/harness/instrumenter.ts +++ b/src/harness/instrumenter.ts @@ -3,11 +3,15 @@ var fs: any = require('fs'); var path: any = require('path'); function instrumentForRecording(fn: string, tscPath: string) { - instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startRecord("' + fn + '");', 'ts.sys.endRecord();'); + instrument(tscPath, ` +ts.sys = Playback.wrapSystem(ts.sys); +ts.sys.startRecord("${ fn }");`, `ts.sys.endRecord();`); } function instrumentForReplay(logFilename: string, tscPath: string) { - instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startReplay("' + logFilename + '");'); + instrument(tscPath, ` +ts.sys = Playback.wrapSystem(ts.sys); +ts.sys.startReplay("${ logFilename }");`); } function instrument(tscPath: string, prepareCode: string, cleanupCode: string = '') { From 36acaff6dc238fb26b6ece20b1cbef1717abab31 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 12 Sep 2015 05:23:53 -0700 Subject: [PATCH 35/75] Add wrapSystem function --- src/harness/loggedIO.ts | 172 ++++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 85 deletions(-) diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 5a572e220b3..3d1833b061f 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -95,6 +95,8 @@ module Playback { export interface PlaybackIO extends Harness.IO, PlaybackControl { } + export interface PlaybackSystem extends ts.System, PlaybackControl { } + function createEmptyLog(): IOLog { return { timestamp: (new Date()).toString(), @@ -114,8 +116,10 @@ module Playback { }; } - function initWrapper(wrapper: PlaybackControl, underlying: T) { - Object.keys(underlying).forEach(prop => { + function initWrapper(wrapper: PlaybackSystem, underlying: ts.System): void; + function initWrapper(wrapper: PlaybackIO, underlying: Harness.IO): void; + function initWrapper(wrapper: PlaybackSystem | PlaybackIO, underlying: ts.System | Harness.IO): void { + ts.forEach(Object.keys(underlying), prop => { (wrapper)[prop] = (underlying)[prop]; }); @@ -135,6 +139,79 @@ module Playback { wrapper.startRecord = (fileNameBase) => { recordLogFileNameBase = fileNameBase; recordLog = createEmptyLog(); + + if (underlying.args !== undefined && typeof underlying.args !== "function") { + recordLog.arguments = underlying.args; + } + }; + + wrapper.startReplayFromFile = logFn => { + wrapper.startReplayFromString(underlying.readFile(logFn)); + }; + wrapper.endRecord = () => { + if (recordLog !== undefined) { + let i = 0; + let fn = () => recordLogFileNameBase + i + ".json"; + while (underlying.fileExists(fn())) i++; + underlying.writeFile(fn(), JSON.stringify(recordLog)); + recordLog = undefined; + } + }; + + wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)( + (path) => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path: path }), + memoize((path) => { + // If we read from the file, it must exist + if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) { + return true; + } else { + return findResultByFields(replayLog.fileExists, { path: path }, false); + } + }) + ); + + wrapper.getExecutingFilePath = () => { + if (replayLog !== undefined) { + return replayLog.executingPath; + } else if (recordLog !== undefined) { + return recordLog.executingPath = underlying.getExecutingFilePath(); + } else { + return underlying.getExecutingFilePath(); + } + }; + + wrapper.getCurrentDirectory = () => { + if (replayLog !== undefined) { + return replayLog.currentDirectory || ""; + } else if (recordLog !== undefined) { + return recordLog.currentDirectory = underlying.getCurrentDirectory(); + } else { + return underlying.getCurrentDirectory(); + } + }; + + wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)( + (path) => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path: path }), + memoize((path) => findResultByFields(replayLog.pathsResolved, { path: path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path)))); + + wrapper.readFile = recordReplay(wrapper.readFile, underlying)( + (path) => { + let result = underlying.readFile(path); + let logEntry = { path: path, codepage: 0, result: { contents: result, codepage: 0 } }; + recordLog.filesRead.push(logEntry); + return result; + }, + memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents)); + + wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)( + (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }), + (path, contents) => noOpReplay("writeFile")); + + wrapper.exit = (exitCode) => { + if (recordLog !== undefined) { + wrapper.endRecord(); + } + underlying.exit(exitCode); }; } @@ -227,93 +304,18 @@ module Playback { let wrapper: PlaybackIO = {}; initWrapper(wrapper, underlying); - wrapper.startReplayFromFile = logFn => { - wrapper.startReplayFromString(underlying.readFile(logFn)); - }; - wrapper.endRecord = () => { - if (recordLog !== undefined) { - let i = 0; - let fn = () => recordLogFileNameBase + i + ".json"; - while (underlying.fileExists(fn())) i++; - underlying.writeFile(fn(), JSON.stringify(recordLog)); - recordLog = undefined; - } - }; - - wrapper.args = () => { - if (replayLog !== undefined) { - return replayLog.arguments; - } else if (recordLog !== undefined) { - recordLog.arguments = underlying.args(); - } - return underlying.args(); - } - - wrapper.newLine = () => underlying.newLine(); - wrapper.useCaseSensitiveFileNames = () => underlying.useCaseSensitiveFileNames(); wrapper.directoryName = (path): string => { throw new Error("NotSupported"); }; - wrapper.createDirectory = path => { throw new Error("NotSupported"); }; + wrapper.createDirectory = (path): void => { throw new Error("NotSupported"); }; wrapper.directoryExists = (path): boolean => { throw new Error("NotSupported"); }; - wrapper.deleteFile = path => { throw new Error("NotSupported"); }; + wrapper.deleteFile = (path): void => { throw new Error("NotSupported"); }; wrapper.listFiles = (path, filter, options): string[] => { throw new Error("NotSupported"); }; - wrapper.log = text => underlying.log(text); - - wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)( - (path) => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path: path }), - memoize((path) => { - // If we read from the file, it must exist - if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) { - return true; - } else { - return findResultByFields(replayLog.fileExists, { path: path }, false); - } - }) - ); - - wrapper.getExecutingFilePath = () => { - if (replayLog !== undefined) { - return replayLog.executingPath; - } else if (recordLog !== undefined) { - return recordLog.executingPath = underlying.getExecutingFilePath(); - } else { - return underlying.getExecutingFilePath(); - } - }; - - wrapper.getCurrentDirectory = () => { - if (replayLog !== undefined) { - return replayLog.currentDirectory || ""; - } else if (recordLog !== undefined) { - return recordLog.currentDirectory = underlying.getCurrentDirectory(); - } else { - return underlying.getCurrentDirectory(); - } - }; - - wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)( - (path) => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path: path }), - memoize((path) => findResultByFields(replayLog.pathsResolved, { path: path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path)))); - - wrapper.readFile = recordReplay(wrapper.readFile, underlying)( - (path) => { - let result = underlying.readFile(path); - let logEntry = { path: path, codepage: 0, result: { contents: result, codepage: 0 } }; - recordLog.filesRead.push(logEntry); - return result; - }, - memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents)); - - wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)( - (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }), - (path, contents) => noOpReplay("writeFile")); - - wrapper.exit = (exitCode) => { - if (recordLog !== undefined) { - wrapper.endRecord(); - } - underlying.exit(exitCode); - }; return wrapper; } + + export function wrapSystem(underlying: ts.System): PlaybackSystem { + let wrapper: PlaybackSystem = {}; + initWrapper(wrapper, underlying); + return wrapper; + } } \ No newline at end of file From 0d126e2ad78252eb6584f2667758deb2b6a03a85 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 12 Sep 2015 14:40:05 -0700 Subject: [PATCH 36/75] add support for tsconfig files in the rwc instrumenter/replay --- src/harness/harness.ts | 8 ++++++++ src/harness/loggedIO.ts | 18 +++++++++++++++++- src/harness/rwcRunner.ts | 20 +++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index f65a4f88730..2493eec867b 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -428,6 +428,7 @@ module Harness { args(): string[]; getExecutingFilePath(): string; exit(exitCode?: number): void; + readDirectory(path: string, extension?: string, exclude?: string[]): string[]; } export var IO: IO; @@ -464,6 +465,7 @@ module Harness { export const directoryExists: typeof IO.directoryExists = fso.FolderExists; export const fileExists: typeof IO.fileExists = fso.FileExists; export const log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine; + export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude); export function createDirectory(path: string) { if (directoryExists(path)) { @@ -532,6 +534,8 @@ module Harness { export const fileExists: typeof IO.fileExists = fs.existsSync; export const log: typeof IO.log = s => console.log(s); + export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude); + export function createDirectory(path: string) { if (!directoryExists(path)) { fs.mkdirSync(path); @@ -730,6 +734,10 @@ module Harness { export function writeFile(path: string, contents: string) { Http.writeToServerSync(serverRoot + path, "WRITE", contents); } + + export function readDirectory(path: string, extension?: string, exclude?: string[]) { + return listFiles(path).filter(f => !extension || ts.fileExtensionIs(f, extension)); + } } } diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 3d1833b061f..38c9cc7e795 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -59,6 +59,12 @@ interface IOLog { path: string; result?: string; }[]; + directoriesRead: { + path: string, + extension: string, + exclude: string[], + result: string[] + }[]; } interface PlaybackControl { @@ -103,6 +109,7 @@ module Playback { arguments: [], currentDirectory: "", filesRead: [], + directoriesRead: [], filesWritten: [], filesDeleted: [], filesAppended: [], @@ -118,7 +125,7 @@ module Playback { function initWrapper(wrapper: PlaybackSystem, underlying: ts.System): void; function initWrapper(wrapper: PlaybackIO, underlying: Harness.IO): void; - function initWrapper(wrapper: PlaybackSystem | PlaybackIO, underlying: ts.System | Harness.IO): void { + function initWrapper(wrapper: PlaybackSystem | PlaybackIO, underlying: ts.System | Harness.IO): void { ts.forEach(Object.keys(underlying), prop => { (wrapper)[prop] = (underlying)[prop]; }); @@ -203,6 +210,15 @@ module Playback { }, memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents)); + wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)( + (path, extension, exclude) => { + let result = (underlying).readDirectory(path, extension, exclude); + let logEntry = { path, extension, exclude, result }; + recordLog.directoriesRead.push(logEntry); + return result; + }, + (path, extension, exclude) => findResultByPath(wrapper, replayLog.directoriesRead.filter(d => d.extension === extension && ts.arrayIsEqualTo(d.exclude, exclude)), path)); + wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)( (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }), (path, contents) => noOpReplay("writeFile")); diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index a1aaeed3d55..8bfb8400c59 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -19,6 +19,11 @@ module RWC { } } + function isTsConfigFile(file: { path: string }): boolean { + const tsConfigFileName = "tsconfig.json"; + return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName; + } + export function runRWCTest(jsonPath: string) { describe("Testing a RWC project: " + jsonPath, () => { let inputFiles: { unitName: string; content: string; }[] = []; @@ -67,8 +72,17 @@ module RWC { runWithIOLog(ioLog, oldIO => { harnessCompiler.reset(); + let fileNames = opts.fileNames; + + let tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined); + if (tsconfigFile) { + let tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path); + let configParseResult = ts.parseConfigFile(tsconfigFileContents.content, Harness.IO, ts.getDirectoryPath(tsconfigFile.path)); + fileNames = configParseResult.fileNames; + } + // Load the files - ts.forEach(opts.fileNames, fileName => { + ts.forEach(fileNames, fileName => { inputFiles.push(getHarnessCompilerInputUnit(fileName)); }); @@ -79,6 +93,10 @@ module RWC { const resolvedPath = ts.normalizeSlashes(Harness.IO.resolvePath(fileRead.path)); let inInputList = ts.forEach(inputFiles, isInInputList(resolvedPath)); + if (isTsConfigFile(fileRead)) { + continue; + } + if (!Harness.isLibraryFile(fileRead.path)) { if (inInputList) { continue; From 7ae902d75ae6ef8b861bcdfde2dc1b0439b36123 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 13 Sep 2015 23:26:52 -0700 Subject: [PATCH 37/75] Handel compiler options correctelly --- src/harness/rwcRunner.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 8bfb8400c59..c6637562ce5 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -77,8 +77,10 @@ module RWC { let tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined); if (tsconfigFile) { let tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path); - let configParseResult = ts.parseConfigFile(tsconfigFileContents.content, Harness.IO, ts.getDirectoryPath(tsconfigFile.path)); + let parsedTsconfigFileContents = ts.parseConfigFileText(tsconfigFile.path, tsconfigFileContents.content); + let configParseResult = ts.parseConfigFile(parsedTsconfigFileContents.config, Harness.IO, ts.getDirectoryPath(tsconfigFile.path)); fileNames = configParseResult.fileNames; + opts.options = ts.extend(opts.options, configParseResult.options); } // Load the files From d9112f5e989eb6d0e3b606ee73deff607a19b9e2 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 13 Sep 2015 23:35:22 -0700 Subject: [PATCH 38/75] use resolvePath to handel relative references correctelly --- src/harness/loggedIO.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 38c9cc7e795..46a791944b6 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -270,7 +270,7 @@ module Playback { } function findResultByPath(wrapper: { resolvePath(s: string): string }, logArray: { path: string; result?: T }[], expectedPath: string, defaultValue?: T): T { - let normalizedName = ts.normalizeSlashes(expectedPath).toLowerCase(); + let normalizedName = ts.normalizePath(expectedPath).toLowerCase(); // Try to find the result through normal fileName for (let i = 0; i < logArray.length; i++) { if (ts.normalizeSlashes(logArray[i].path).toLowerCase() === normalizedName) { @@ -286,6 +286,7 @@ module Playback { } } } + // If we got here, we didn't find a match if (defaultValue === undefined) { throw new Error("No matching result in log array for path: " + expectedPath); From c1e536f2555a7842ae9afa545f6661400f77d4d5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 15 Sep 2015 12:33:45 -0700 Subject: [PATCH 39/75] code review comments --- src/harness/loggedIO.ts | 50 ++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 46a791944b6..d0801612500 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -147,7 +147,7 @@ module Playback { recordLogFileNameBase = fileNameBase; recordLog = createEmptyLog(); - if (underlying.args !== undefined && typeof underlying.args !== "function") { + if (typeof underlying.args !== "function") { recordLog.arguments = underlying.args; } }; @@ -166,13 +166,14 @@ module Playback { }; wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)( - (path) => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path: path }), - memoize((path) => { + path => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path }), + memoize(path => { // If we read from the file, it must exist if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) { return true; - } else { - return findResultByFields(replayLog.fileExists, { path: path }, false); + } + else { + return findResultByFields(replayLog.fileExists, { path }, false); } }) ); @@ -180,9 +181,11 @@ module Playback { wrapper.getExecutingFilePath = () => { if (replayLog !== undefined) { return replayLog.executingPath; - } else if (recordLog !== undefined) { + } + else if (recordLog !== undefined) { return recordLog.executingPath = underlying.getExecutingFilePath(); - } else { + } + else { return underlying.getExecutingFilePath(); } }; @@ -190,25 +193,27 @@ module Playback { wrapper.getCurrentDirectory = () => { if (replayLog !== undefined) { return replayLog.currentDirectory || ""; - } else if (recordLog !== undefined) { + } + else if (recordLog !== undefined) { return recordLog.currentDirectory = underlying.getCurrentDirectory(); - } else { + } + else { return underlying.getCurrentDirectory(); } }; wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)( - (path) => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path: path }), - memoize((path) => findResultByFields(replayLog.pathsResolved, { path: path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path)))); + path => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path }), + memoize(path => findResultByFields(replayLog.pathsResolved, { path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path)))); wrapper.readFile = recordReplay(wrapper.readFile, underlying)( - (path) => { + path => { let result = underlying.readFile(path); - let logEntry = { path: path, codepage: 0, result: { contents: result, codepage: 0 } }; + let logEntry = { path, codepage: 0, result: { contents: result, codepage: 0 } }; recordLog.filesRead.push(logEntry); return result; }, - memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents)); + memoize(path => findResultByPath(wrapper, replayLog.filesRead, path).contents)); wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)( (path, extension, exclude) => { @@ -220,7 +225,7 @@ module Playback { (path, extension, exclude) => findResultByPath(wrapper, replayLog.directoriesRead.filter(d => d.extension === extension && ts.arrayIsEqualTo(d.exclude, exclude)), path)); wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)( - (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }), + (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }), (path, contents) => noOpReplay("writeFile")); wrapper.exit = (exitCode) => { @@ -236,9 +241,11 @@ module Playback { return (function () { if (replayLog !== undefined) { return replay.apply(undefined, arguments); - } else if (recordLog !== undefined) { + } + else if (recordLog !== undefined) { return record.apply(undefined, arguments); - } else { + } + else { return original.apply(underlying, arguments); } }); @@ -262,7 +269,8 @@ module Playback { if (results.length === 0) { if (defaultValue !== undefined) { return defaultValue; - } else { + } + else { throw new Error("No matching result in log array for: " + JSON.stringify(expectedFields)); } } @@ -290,7 +298,8 @@ module Playback { // If we got here, we didn't find a match if (defaultValue === undefined) { throw new Error("No matching result in log array for path: " + expectedPath); - } else { + } + else { return defaultValue; } } @@ -308,7 +317,8 @@ module Playback { } if (pathEquivCache.hasOwnProperty(key)) { return pathEquivCache[key]; - } else { + } + else { return pathEquivCache[key] = check(); } } From 00dcb57e3b7403918923991782a99a4a7822f527 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 15 Sep 2015 15:08:48 -0700 Subject: [PATCH 40/75] Bump version back to 1.7.0. --- package.json | 2 +- src/compiler/program.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8ce9989b617..b743b04838d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.6.2", + "version": "1.7.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5664fc7c462..3da3c354fb2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -12,7 +12,7 @@ namespace ts { let emptyArray: any[] = []; - export const version = "1.6.2"; + export const version = "1.7.0"; export function findConfigFile(searchPath: string): string { let fileName = "tsconfig.json"; From ad8bcfabdce1a50d0220eca391bdc5d2735a7853 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 15 Sep 2015 15:18:24 -0700 Subject: [PATCH 41/75] handeles -> handles --- tests/cases/unittests/services/preProcessFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index 7b645069212..a3f8db5528f 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -174,7 +174,7 @@ describe('PreProcessFile:', function () { }) }); - it("Correctly handeles export import declarations", function () { + it("Correctly handles export import declarations", function () { test("export import a = require(\"m1\");", true, { From 4fedd77c3310eeebb6bc189f99e0be2b2e916766 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 15 Sep 2015 15:18:59 -0700 Subject: [PATCH 42/75] Update LKG. --- lib/tsc.js | 303 ++++++++++++------- lib/tsserver.js | 570 ++++++++++++++---------------------- lib/typescript.d.ts | 5 +- lib/typescript.js | 397 ++++++++++++++++--------- lib/typescriptServices.d.ts | 5 +- lib/typescriptServices.js | 397 ++++++++++++++++--------- 6 files changed, 932 insertions(+), 745 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index a98799b1d86..3983b8c1e1b 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -1248,7 +1248,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -1419,6 +1419,7 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -1431,8 +1432,10 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1625,6 +1628,10 @@ var ts; /// var ts; (function (ts) { + function tokenIsIdentifierOrKeyword(token) { + return token >= 67; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { "abstract": 113, "any": 115, @@ -2916,7 +2923,7 @@ var ts; return token = 234; } function scanJsxIdentifier() { - if (token === 67) { + if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -4032,6 +4039,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { if (149 <= node.kind && node.kind <= 158) { return true; @@ -6434,10 +6442,10 @@ var ts; return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName() { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || + return ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8; } @@ -6457,7 +6465,7 @@ var ts; return parsePropertyNameWorker(false); } function isSimplePropertyName() { - return token === 9 || token === 8 || isIdentifierOrKeyword(); + return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { var node = createNode(134); @@ -6548,9 +6556,9 @@ var ts; case 20: return isHeritageClause(); case 21: - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); case 13: - return isIdentifierOrKeyword() || token === 15; + return ts.tokenIsIdentifierOrKeyword(token) || token === 15; case 14: return true; case 22: @@ -6576,7 +6584,7 @@ var ts; } function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 104 || @@ -6944,7 +6952,7 @@ var ts; return entity; } function parseRightSideOfDot(allowIdentifierNames) { - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); @@ -7234,7 +7242,7 @@ var ts; return result; } } - if (isIdentifierOrKeyword()) { + if (ts.tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -8527,12 +8535,9 @@ var ts; return finishNode(expressionStatement); } } - function isIdentifierOrKeyword() { - return token >= 67; - } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); @@ -8540,7 +8545,7 @@ var ts; } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 8) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { @@ -8568,7 +8573,7 @@ var ts; case 87: nextToken(); return token === 9 || token === 37 || - token === 15 || isIdentifierOrKeyword(); + token === 15 || ts.tokenIsIdentifierOrKeyword(token); case 80: nextToken(); if (token === 55 || token === 37 || @@ -9055,7 +9060,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } - if (isIdentifierOrKeyword() || + if (ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8 || token === 37 || @@ -9183,12 +9188,13 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(216, fullStart); + var namespaceFlag = flags & 131072; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -9448,7 +9454,7 @@ var ts; case 95: return true; } - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { @@ -10968,7 +10974,7 @@ var ts; var moduleReferenceLiteral = moduleReferenceExpression; var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } var isRelative = isExternalModuleNameRelative(moduleName); @@ -12099,52 +12105,52 @@ var ts; return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, false); } return undefined; } - function getTypeFromBindingElement(element) { + function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (ts.isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } - function getTypeFromObjectBindingPattern(pattern) { + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } - function getTypeFromArrayBindingPattern(pattern) { - var hasSpreadElement = false; - var elementTypes = []; - ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 185 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - var unionOfElements = getUnionType(elementTypes); - return languageVersion >= 2 ? createIterableType(unionOfElements) : createArrayType(unionOfElements); + var elementTypes = ts.map(elements, function (e) { return e.kind === 185 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; } return createTupleType(elementTypes); } - function getTypeFromBindingPattern(pattern) { + function getTypeFromBindingPattern(pattern, includePatternInType) { return pattern.kind === 159 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -13466,11 +13472,11 @@ var ts; } function createTupleType(elementTypes) { var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } function getTypeFromTupleTypeNode(node) { @@ -13958,7 +13964,9 @@ var ts; } return 0; } - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & 49152) { + source = getRegularTypeOfObjectLiteral(source); + } } var saveErrorInfo = errorInfo; if (source.flags & 16384) { @@ -14357,8 +14365,8 @@ var ts; return result; function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { if (sourceSig && targetSig) { - var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212); - var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212); + var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { return -1; } @@ -14366,8 +14374,8 @@ var ts; var targetErasedSignature = getErasedSignature(targetSig); var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { @@ -14690,6 +14698,7 @@ var ts; regularType.constructSignatures = type.constructSignatures; regularType.stringIndexType = type.stringIndexType; regularType.numberIndexType = type.numberIndexType; + type.regularType = regularType; } return regularType; } @@ -15586,7 +15595,7 @@ var ts; } } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, true); } } return undefined; @@ -15878,11 +15887,12 @@ var ts; var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } + function hasDefaultValue(node) { + return (node.kind === 161 && !!node.initializer) || + (node.kind === 179 && node.operatorToken.kind === 55); + } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); @@ -15903,12 +15913,35 @@ var ts; hasSpreadElement = hasSpreadElement || e.kind === 183; } if (!hasSpreadElement) { + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } var contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + if (pattern && (pattern.kind === 160 || pattern.kind === 162)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 185) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); @@ -15940,6 +15973,9 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 159 || contextualType.pattern.kind === 163); + var inDestructuringPattern = isAssignmentTarget(node); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; @@ -15960,6 +15996,20 @@ var ts; } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); + if (inDestructuringPattern) { + if (memberDecl.kind === 243 && hasDefaultValue(memberDecl.initializer)) { + prop.flags |= 536870912; + } + } + else if (contextualTypeHasPattern) { + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -15978,11 +16028,26 @@ var ts; } propertiesArray.push(member); } + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -17066,7 +17131,7 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212); + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & 256) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -19732,6 +19797,9 @@ var ts; function getTargetSymbol(s) { return s.flags & 16777216 ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { // TypeScript 1.0 spec (April 2014): 8.2.3 // A derived class inherits all members from its base class it doesn't override. @@ -19758,9 +19826,14 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212); + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { - error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (derivedClassDecl.kind === 184) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -23696,6 +23769,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -25364,7 +25438,8 @@ var ts; operand.kind !== 178 && operand.kind !== 167 && !(operand.kind === 166 && node.parent.kind === 167) && - !(operand.kind === 171 && node.parent.kind === 166)) { + !(operand.kind === 171 && node.parent.kind === 166) && + !(operand.kind === 8 && node.parent.kind === 164)) { emit(operand); return; } @@ -26432,7 +26507,7 @@ var ts; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (node.kind !== 141 && node.kind !== 140 && node.parent && node.parent.kind !== 243 && @@ -26750,7 +26825,7 @@ var ts; } else if (member.kind === 141 || node.kind === 140) { if (!member.body) { - return emitOnlyPinnedOrTripleSlashComments(member); + return emitCommentsOnNotEmittedNode(member); } writeLine(); emitLeadingComments(member); @@ -26816,7 +26891,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 141 || node.kind === 140) && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } else if (member.kind === 141 || member.kind === 143 || @@ -26863,7 +26938,7 @@ var ts; var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { if (member.kind === 142 && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; @@ -27493,7 +27568,7 @@ var ts; return argumentsWritten; } function emitInterfaceDeclaration(node) { - emitOnlyPinnedOrTripleSlashComments(node); + emitCommentsOnNotEmittedNode(node); } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); @@ -27600,7 +27675,7 @@ var ts; function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); @@ -28738,7 +28813,7 @@ var ts; function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { if (node.flags & 2) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { return emitNodeWithoutSourceMap(node); @@ -28970,14 +29045,20 @@ var ts; } return leadingComments; } - function filterComments(ranges, onlyPinnedOrTripleSlashComments) { - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = ts.filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + function isTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; } - return ranges; + return false; } function getLeadingCommentsToEmit(node) { if (node.parent) { @@ -28998,26 +29079,46 @@ var ts; } } } - function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, true); + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, true); } - function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { - var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitTrailingComments(node) { - var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } function emitTrailingCommentsOfPosition(pos) { - var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); } - function emitLeadingCommentsOfPosition(pos) { + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } var leadingComments; if (hasDetachedComments(pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -29025,12 +29126,19 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedComments(node) { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingComments; + if (compilerOptions.removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } if (leadingComments) { var detachedComments = []; var lastComment; @@ -29068,17 +29176,6 @@ var ts; write(shebang); } } - function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { - return true; - } - } } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -29354,7 +29451,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.6.2"; + ts.version = "1.7.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -30019,7 +30116,7 @@ var ts; if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { var start_3 = ts.getTokenPosOfNode(file.imports[i], file); @@ -30549,10 +30646,10 @@ var ts; } } ts.parseCommandLine = parseCommandLine; - function readConfigFile(fileName) { + function readConfigFile(fileName, readFile) { var text = ""; try { - text = ts.sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; @@ -30821,7 +30918,7 @@ var ts; function performCompilation() { if (!cachedProgram) { if (configFileName) { - var result = ts.readConfigFile(configFileName); + var result = ts.readConfigFile(configFileName, ts.sys.readFile); if (result.error) { reportDiagnostic(result.error); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); diff --git a/lib/tsserver.js b/lib/tsserver.js index ce095409d9a..875e63028b2 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -47,7 +47,6 @@ var ts; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); -/// var ts; (function (ts) { function createFileMap(getCanonicalFileName) { @@ -569,9 +568,6 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { - // Get root length of http://www.website.com/folder1/foler2/ - // In this example the root is: http://www.website.com/ - // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { @@ -731,7 +727,6 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.sys = (function () { @@ -1003,7 +998,6 @@ var ts; } })(); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.Diagnostics = { @@ -1248,7 +1242,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -1419,6 +1413,7 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -1431,8 +1426,10 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1621,10 +1618,12 @@ var ts; A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { + function tokenIsIdentifierOrKeyword(token) { + return token >= 67; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { "abstract": 113, "any": 115, @@ -1872,16 +1871,6 @@ var ts; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - // ES5 7.3: - // The ECMAScript line terminator characters are listed in Table 3. - // Table 3: Line Terminator Characters - // Code Unit Value Name Formal Name - // \u000A Line Feed - // \u000D Carriage Return - // \u2028 Line separator - // \u2029 Paragraph separator - // Only the characters in Table 3 are treated as line terminators. Other new line or line - // breaking characters are treated as white space but not as line terminators. return ch === 10 || ch === 13 || ch === 8232 || @@ -2916,7 +2905,7 @@ var ts; return token = 234; } function scanJsxIdentifier() { - if (token === 67) { + if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -2983,10 +2972,6 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { ts.optionDeclarations = [ @@ -3341,10 +3326,10 @@ var ts; } } ts.parseCommandLine = parseCommandLine; - function readConfigFile(fileName) { + function readConfigFile(fileName, readFile) { var text = ""; try { - text = ts.sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; @@ -3445,7 +3430,6 @@ var ts; } ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { @@ -3780,6 +3764,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { if (149 <= node.kind && node.kind <= 158) { return true; @@ -5393,8 +5378,6 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var nodeConstructors = new Array(270); @@ -5885,10 +5868,6 @@ var ts; } } function fixupParentReferences(sourceFile) { - // normally parent references are set during binding. However, for clients that only need - // a syntax tree, and no semantic features, then the binding process is an unnecessary - // overhead. This functions allows us to set all the parents, without all the expense of - // binding. var parent = sourceFile; forEachChild(sourceFile, visitNode); return; @@ -6182,10 +6161,10 @@ var ts; return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName() { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || + return ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8; } @@ -6205,7 +6184,7 @@ var ts; return parsePropertyNameWorker(false); } function isSimplePropertyName() { - return token === 9 || token === 8 || isIdentifierOrKeyword(); + return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { var node = createNode(134); @@ -6296,9 +6275,9 @@ var ts; case 20: return isHeritageClause(); case 21: - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); case 13: - return isIdentifierOrKeyword() || token === 15; + return ts.tokenIsIdentifierOrKeyword(token) || token === 15; case 14: return true; case 22: @@ -6324,7 +6303,7 @@ var ts; } function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 104 || @@ -6692,7 +6671,7 @@ var ts; return entity; } function parseRightSideOfDot(allowIdentifierNames) { - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); @@ -6982,7 +6961,7 @@ var ts; return result; } } - if (isIdentifierOrKeyword()) { + if (ts.tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -7220,9 +7199,6 @@ var ts; return allowInAnd(parseExpression); } function parseExpression() { - // Expression[in]: - // AssignmentExpression[in] - // Expression[in] , AssignmentExpression[in] var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); @@ -7247,15 +7223,6 @@ var ts; return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { - // AssignmentExpression[in,yield]: - // 1) ConditionalExpression[?in,?yield] - // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] - // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] - // 4) ArrowFunctionExpression[?in,?yield] - // 5) [+Yield] YieldExpression[?In] - // - // Note: for ease of implementation we treat productions '2' and '3' as the same thing. - // (i.e. they're both BinaryExpressions with an assignment operator in it). if (isYieldExpression()) { return parseYieldExpression(); } @@ -8224,8 +8191,6 @@ var ts; return finishNode(node); } function parseThrowStatement() { - // ThrowStatement[Yield] : - // throw [no LineTerminator here]Expression[In, ?Yield]; var node = createNode(206); parseExpected(96); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); @@ -8275,12 +8240,9 @@ var ts; return finishNode(expressionStatement); } } - function isIdentifierOrKeyword() { - return token >= 67; - } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); @@ -8288,7 +8250,7 @@ var ts; } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 8) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { @@ -8316,7 +8278,7 @@ var ts; case 87: nextToken(); return token === 9 || token === 37 || - token === 15 || isIdentifierOrKeyword(); + token === 15 || ts.tokenIsIdentifierOrKeyword(token); case 80: nextToken(); if (token === 55 || token === 37 || @@ -8803,7 +8765,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } - if (isIdentifierOrKeyword() || + if (ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8 || token === 37 || @@ -8840,8 +8802,6 @@ var ts; return finishNode(node); } function parseHeritageClauses(isClassHeritageClause) { - // ClassTail[Yield,Await] : (Modified) See 14.5 - // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } if (isHeritageClause()) { return parseList(20, parseHeritageClause); } @@ -8931,12 +8891,13 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(216, fullStart); + var namespaceFlag = flags & 131072; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -9007,12 +8968,6 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - // ImportClause: - // ImportedDefaultBinding - // NameSpaceImport - // NamedImports - // ImportedDefaultBinding, NameSpaceImport - // ImportedDefaultBinding, NamedImports var importClause = createNode(221, fullStart); if (identifier) { importClause.name = identifier; @@ -9196,7 +9151,7 @@ var ts; case 95: return true; } - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { @@ -9969,7 +9924,6 @@ var ts; } })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.bindTime = 0; @@ -10683,7 +10637,6 @@ var ts; } } })(ts || (ts = {})); -/// var ts; (function (ts) { var nextSymbolId = 1; @@ -11430,7 +11383,7 @@ var ts; var moduleReferenceLiteral = moduleReferenceExpression; var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } var isRelative = isExternalModuleNameRelative(moduleName); @@ -12561,52 +12514,52 @@ var ts; return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, false); } return undefined; } - function getTypeFromBindingElement(element) { + function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (ts.isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } - function getTypeFromObjectBindingPattern(pattern) { + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } - function getTypeFromArrayBindingPattern(pattern) { - var hasSpreadElement = false; - var elementTypes = []; - ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 185 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - var unionOfElements = getUnionType(elementTypes); - return languageVersion >= 2 ? createIterableType(unionOfElements) : createArrayType(unionOfElements); + var elementTypes = ts.map(elements, function (e) { return e.kind === 185 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; } return createTupleType(elementTypes); } - function getTypeFromBindingPattern(pattern) { + function getTypeFromBindingPattern(pattern, includePatternInType) { return pattern.kind === 159 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -13928,11 +13881,11 @@ var ts; } function createTupleType(elementTypes) { var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } function getTypeFromTupleTypeNode(node) { @@ -14420,7 +14373,9 @@ var ts; } return 0; } - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & 49152) { + source = getRegularTypeOfObjectLiteral(source); + } } var saveErrorInfo = errorInfo; if (source.flags & 16384) { @@ -14819,8 +14774,8 @@ var ts; return result; function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { if (sourceSig && targetSig) { - var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212); - var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212); + var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { return -1; } @@ -14828,8 +14783,8 @@ var ts; var targetErasedSignature = getErasedSignature(targetSig); var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { @@ -15152,6 +15107,7 @@ var ts; regularType.constructSignatures = type.constructSignatures; regularType.stringIndexType = type.stringIndexType; regularType.numberIndexType = type.numberIndexType; + type.regularType = regularType; } return regularType; } @@ -16048,7 +16004,7 @@ var ts; } } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, true); } } return undefined; @@ -16340,11 +16296,12 @@ var ts; var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } + function hasDefaultValue(node) { + return (node.kind === 161 && !!node.initializer) || + (node.kind === 179 && node.operatorToken.kind === 55); + } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); @@ -16365,12 +16322,35 @@ var ts; hasSpreadElement = hasSpreadElement || e.kind === 183; } if (!hasSpreadElement) { + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } var contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + if (pattern && (pattern.kind === 160 || pattern.kind === 162)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 185) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); @@ -16402,6 +16382,9 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 159 || contextualType.pattern.kind === 163); + var inDestructuringPattern = isAssignmentTarget(node); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; @@ -16422,6 +16405,20 @@ var ts; } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); + if (inDestructuringPattern) { + if (memberDecl.kind === 243 && hasDefaultValue(memberDecl.initializer)) { + prop.flags |= 536870912; + } + } + else if (contextualTypeHasPattern) { + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -16440,11 +16437,26 @@ var ts; } propertiesArray.push(member); } + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -17528,7 +17540,7 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212); + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & 256) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -18523,10 +18535,6 @@ var ts; } } function checkParameter(node) { - // Grammar checking - // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the - // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code - // or if its FunctionBody is strict code(11.1.5). checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); @@ -19169,15 +19177,6 @@ var ts; return type; } function getPromisedType(promise) { - // - // { // promise - // then( // thenFunction - // onfulfilled: ( // onfulfilledParameterType - // value: T // valueParameterType - // ) => any - // ): any; - // } - // if (promise.flags & 1) { return undefined; } @@ -19520,9 +19519,6 @@ var ts; } } function checkVarDeclaredNamesNotShadowed(node) { - // - ScriptBody : StatementList - // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList - // also occurs in the VarDeclaredNames of StatementList. if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } @@ -20194,20 +20190,10 @@ var ts; function getTargetSymbol(s) { return s.flags & 16777216 ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { - // TypeScript 1.0 spec (April 2014): 8.2.3 - // A derived class inherits all members from its base class it doesn't override. - // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. - // Both public and private property members are inherited, but only public property members can be overridden. - // A property member in a derived class is said to override a property member in a base class - // when the derived class property member has the same name and kind(instance or static) - // as the base class property member. - // The type of an overriding property member must be assignable(section 3.8.4) - // to the type of the overridden property member, or otherwise a compile - time error occurs. - // Base class instance member functions can be overridden by derived class instance member functions, - // but not by other kinds of members. - // Base class instance member variables and accessors can be overridden by - // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; @@ -20220,9 +20206,14 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212); + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { - error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (derivedClassDecl.kind === 184) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -22736,7 +22727,6 @@ var ts; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { @@ -24064,8 +24054,6 @@ var ts; } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { function isExternalModuleOrDeclarationFile(sourceFile) { @@ -24158,6 +24146,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -24804,19 +24793,6 @@ var ts; write(")"); } function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar ts.Debug.assert(node.templateSpans.length !== 0); return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; } @@ -25826,7 +25802,8 @@ var ts; operand.kind !== 178 && operand.kind !== 167 && !(operand.kind === 166 && node.parent.kind === 167) && - !(operand.kind === 171 && node.parent.kind === 166)) { + !(operand.kind === 171 && node.parent.kind === 166) && + !(operand.kind === 8 && node.parent.kind === 164)) { emit(operand); return; } @@ -26156,26 +26133,6 @@ var ts; emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. var endPos = emitToken(84, node.pos); write(" "); endPos = emitToken(17, endPos); @@ -26894,7 +26851,7 @@ var ts; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (node.kind !== 141 && node.kind !== 140 && node.parent && node.parent.kind !== 243 && @@ -27212,7 +27169,7 @@ var ts; } else if (member.kind === 141 || node.kind === 140) { if (!member.body) { - return emitOnlyPinnedOrTripleSlashComments(member); + return emitCommentsOnNotEmittedNode(member); } writeLine(); emitLeadingComments(member); @@ -27278,7 +27235,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 141 || node.kind === 140) && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } else if (member.kind === 141 || member.kind === 143 || @@ -27325,7 +27282,7 @@ var ts; var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { if (member.kind === 142 && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; @@ -27955,7 +27912,7 @@ var ts; return argumentsWritten; } function emitInterfaceDeclaration(node) { - emitOnlyPinnedOrTripleSlashComments(node); + emitCommentsOnNotEmittedNode(node); } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); @@ -28062,7 +28019,7 @@ var ts; function emitModuleDeclaration(node) { var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); @@ -28906,17 +28863,6 @@ var ts; write("});"); } function emitAMDDependencies(node, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list var aliasedModuleNames = []; var unaliasedModuleNames = []; var importAliasNames = []; @@ -29200,7 +29146,7 @@ var ts; function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { if (node.flags & 2) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { return emitNodeWithoutSourceMap(node); @@ -29432,14 +29378,20 @@ var ts; } return leadingComments; } - function filterComments(ranges, onlyPinnedOrTripleSlashComments) { - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = ts.filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + function isTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; } - return ranges; + return false; } function getLeadingCommentsToEmit(node) { if (node.parent) { @@ -29460,26 +29412,46 @@ var ts; } } } - function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, true); + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, true); } - function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { - var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitTrailingComments(node) { - var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } function emitTrailingCommentsOfPosition(pos) { - var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); } - function emitLeadingCommentsOfPosition(pos) { + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } var leadingComments; if (hasDetachedComments(pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -29487,12 +29459,19 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedComments(node) { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingComments; + if (compilerOptions.removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } if (leadingComments) { var detachedComments = []; var lastComment; @@ -29530,17 +29509,6 @@ var ts; write(shebang); } } - function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { - return true; - } - } } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -29806,9 +29774,6 @@ var ts; "diams": 0x2666 }; })(ts || (ts = {})); -/// -/// -/// var ts; (function (ts) { ts.programTime = 0; @@ -29816,7 +29781,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.6.2"; + ts.version = "1.7.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -30481,7 +30446,7 @@ var ts; if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { var start_3 = ts.getTokenPosOfNode(file.imports[i], file); @@ -30653,9 +30618,6 @@ var ts; } ts.createProgram = createProgram; })(ts || (ts = {})); -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. -/// var ts; (function (ts) { var BreakpointResolver; @@ -31315,7 +31277,6 @@ var ts; NavigateTo.getNavigateToItems = getNavigateToItems; })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var NavigationBar; @@ -32136,7 +32097,6 @@ var ts; return transition; } })(ts || (ts = {})); -/// var ts; (function (ts) { var SignatureHelp; @@ -33104,8 +33064,6 @@ var ts; } ts.stripQuotes = stripQuotes; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33299,7 +33257,6 @@ var ts; formatting.getFormattingScanner = getFormattingScanner; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -33378,8 +33335,6 @@ var ts; formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33401,8 +33356,6 @@ var ts; formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33433,8 +33386,6 @@ var ts; formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33462,7 +33413,6 @@ var ts; formatting.RuleOperation = RuleOperation; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -33496,16 +33446,12 @@ var ts; formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; (function (formatting) { var Rules = (function () { function Rules() { - /// - /// Common Rules - /// this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -33546,7 +33492,7 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100, 96, 90, 76, 92, 99]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100, 96, 90, 76, 92, 99, 117]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); @@ -33560,7 +33506,7 @@ var ts; this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 125]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113, 71, 120, 75, 79, 80, 81, 121, 104, 87, 105, 123, 124, 108, 110, 109, 127, 111]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113, 71, 120, 75, 79, 80, 81, 121, 104, 87, 105, 123, 124, 108, 110, 109, 127, 111, 130]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81, 104])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); @@ -33581,19 +33527,7 @@ var ts; this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116, 85), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116, 85), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -33619,12 +33553,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword, - this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword, - this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, - this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, - this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, + this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, @@ -33700,6 +33630,8 @@ var ts; case 180: case 187: case 148: + case 156: + case 157: return true; case 161: case 214: @@ -33724,22 +33656,6 @@ var ts; return context.contextNode.kind === 180; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { - //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. - //// - //// Ex: - //// if (1) { .... - //// * ) and { are on the same line so apply the rule. Here we don't care whether it's same or multi block context - //// - //// Ex: - //// if (1) - //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. - //// - //// Ex: - //// if (1) - //// { ... - //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBeforeMultilineBlockContext = function (context) { @@ -33923,7 +33839,6 @@ var ts; formatting.Rules = Rules; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -34060,7 +33975,6 @@ var ts; formatting.RulesBucket = RulesBucket; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -34175,19 +34089,6 @@ var ts; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// var ts; (function (ts) { var formatting; @@ -34283,10 +34184,6 @@ var ts; formatting.RulesProvider = RulesProvider; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var formatting; @@ -34543,13 +34440,14 @@ var ts; } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind) { + getIndentationForComment: function (kind, tokenIndentation) { switch (kind) { case 16: case 20: + case 18: return indentation + delta; } - return indentation; + return tokenIndentation !== -1 ? tokenIndentation : indentation; }, getIndentationForToken: function (line, kind) { if (nodeStartLine !== line && node.decorators) { @@ -34718,8 +34616,12 @@ var ts; processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); } if (indentToken) { - var indentNextTokenOrTrivia = true; + var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + -1; if (currentTokenInfo.leadingTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + var indentNextTokenOrTrivia = true; for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { @@ -34727,14 +34629,12 @@ var ts; } switch (triviaItem.kind) { case 3: - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2: if (indentNextTokenOrTrivia) { - var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, false); + insertIndentation(triviaItem.pos, commentIndentation, false); indentNextTokenOrTrivia = false; } break; @@ -34744,8 +34644,7 @@ var ts; } } } - if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + if (tokenIndentation !== -1) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -35033,7 +34932,6 @@ var ts; formatting.getIndentationString = getIndentationString; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -35392,21 +35290,11 @@ var ts; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -/// -/// -/// -/// -/// -/// -/// -/// -/// var ts; (function (ts) { ts.servicesVersion = "0.4"; @@ -39357,6 +39245,7 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; + case 184: case 212: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); @@ -40240,8 +40129,6 @@ var ts; return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } function getTodoCommentsRegExp() { - // NOTE: ?: means 'non-capture group'. It allows us to have groups without having to - // filter them out later in the final result array. var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; @@ -40744,10 +40631,6 @@ var ts; } initializeServices(); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var server; @@ -41710,10 +41593,6 @@ var ts; server.Session = Session; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var server; @@ -43496,8 +43375,6 @@ var ts; server.LineLeaf = LineLeaf; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var server; @@ -43720,21 +43597,6 @@ var ts; ioSession.listen(); })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/// var debugObjectHost = this; var ts; (function (ts) { diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index ec4ccd15589..2cd3a663fce 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -1208,9 +1208,11 @@ declare namespace ts { UnionOrIntersection = 49152, StructuredType = 130048, } + type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { flags: TypeFlags; symbol?: Symbol; + pattern?: DestructuringPattern; } interface StringLiteralType extends Type { text: string; @@ -1237,7 +1239,6 @@ declare namespace ts { } interface TupleType extends ObjectType { elementTypes: Type[]; - baseArrayType: TypeReference; } interface UnionOrIntersectionType extends Type { types: Type[]; @@ -1532,7 +1533,7 @@ declare namespace ts { * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName: string): { + function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic; }; diff --git a/lib/typescript.js b/lib/typescript.js index ebc0ba70357..2c70f56d0a6 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -2117,7 +2117,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -2288,6 +2288,7 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2300,8 +2301,10 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2494,6 +2497,11 @@ var ts; /// var ts; (function (ts) { + /* @internal */ + function tokenIsIdentifierOrKeyword(token) { + return token >= 67 /* Identifier */; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { "abstract": 113 /* AbstractKeyword */, "any": 115 /* AnyKeyword */, @@ -3929,7 +3937,7 @@ var ts; // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes function scanJsxIdentifier() { - if (token === 67 /* Identifier */) { + if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -5331,6 +5339,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { return true; @@ -8131,10 +8140,10 @@ var ts; return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName() { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || + return ts.tokenIsIdentifierOrKeyword(token) || token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */; } @@ -8154,7 +8163,7 @@ var ts; return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); } function isSimplePropertyName() { - return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || isIdentifierOrKeyword(); + return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { // PropertyName [Yield]: @@ -8270,9 +8279,9 @@ var ts; case 20 /* HeritageClauses */: return isHeritageClause(); case 21 /* ImportOrExportSpecifiers */: - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); case 13 /* JsxAttributes */: - return isIdentifierOrKeyword() || token === 15 /* OpenBraceToken */; + return ts.tokenIsIdentifierOrKeyword(token) || token === 15 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; case 22 /* JSDocFunctionParameters */: @@ -8305,7 +8314,7 @@ var ts; } function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 104 /* ImplementsKeyword */ || @@ -8799,7 +8808,7 @@ var ts; // the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword". // In the first case though, ASI will not take effect because there is not a // line terminator after the identifier or keyword. - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { // Report that we need an identifier. However, report it right after the dot, @@ -9183,7 +9192,7 @@ var ts; return result; } } - if (isIdentifierOrKeyword()) { + if (ts.tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -10776,12 +10785,9 @@ var ts; return finishNode(expressionStatement); } } - function isIdentifierOrKeyword() { - return token >= 67 /* Identifier */; - } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); @@ -10789,7 +10795,7 @@ var ts; } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { @@ -10839,7 +10845,7 @@ var ts; case 87 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || isIdentifierOrKeyword(); + token === 15 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token); case 80 /* ExportKeyword */: nextToken(); if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || @@ -11379,7 +11385,7 @@ var ts; } // It is very important that we check this *after* checking indexers because // the [ token can start an index signature or a computed property name - if (isIdentifierOrKeyword() || + if (ts.tokenIsIdentifierOrKeyword(token) || token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || token === 37 /* AsteriskToken */ || @@ -11518,12 +11524,15 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(216 /* ModuleDeclaration */, fullStart); + // If we are parsing a dotted namespace name, we want to + // propagate the 'Namespace' flag across the names if set. + var namespaceFlag = flags & 131072 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -11857,7 +11866,7 @@ var ts; case 95 /* ThisKeyword */: return true; } - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { @@ -13747,7 +13756,7 @@ var ts; // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } var isRelative = isExternalModuleNameRelative(moduleName); @@ -15051,7 +15060,7 @@ var ts; } // If the declaration specifies a binding pattern, use the type implied by the binding pattern if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ false); } // No type specified and nothing can be inferred return undefined; @@ -15059,45 +15068,45 @@ var ts; // Return the type implied by a binding pattern element. This is the type of the initializer of the element if // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding // pattern. Otherwise, it is the type any. - function getTypeFromBindingElement(element) { + function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (ts.isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } // Return the type implied by an object binding pattern - function getTypeFromObjectBindingPattern(pattern) { + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } // Return the type implied by an array binding pattern - function getTypeFromArrayBindingPattern(pattern) { - var hasSpreadElement = false; - var elementTypes = []; - ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 185 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - var unionOfElements = getUnionType(elementTypes); - return languageVersion >= 2 /* ES6 */ ? createIterableType(unionOfElements) : createArrayType(unionOfElements); - } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. + var elementTypes = ts.map(elements, function (e) { return e.kind === 185 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; + } return createTupleType(elementTypes); } // Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself @@ -15107,10 +15116,10 @@ var ts; // used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. - function getTypeFromBindingPattern(pattern) { + function getTypeFromBindingPattern(pattern, includePatternInType) { return pattern.kind === 159 /* ObjectBindingPattern */ - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } // Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type // specified in a type annotation or inferred from an initializer. However, in the case of a destructuring declaration it @@ -16578,11 +16587,11 @@ var ts; } function createTupleType(elementTypes) { var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } function getTypeFromTupleTypeNode(node) { @@ -17119,7 +17128,9 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & 49152 /* UnionOrIntersection */) { + source = getRegularTypeOfObjectLiteral(source); + } } var saveErrorInfo = errorInfo; // Note that the "each" checks must precede the "some" checks to produce the correct results @@ -17567,8 +17578,8 @@ var ts; return result; function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { if (sourceSig && targetSig) { - var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212 /* ClassDeclaration */); - var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212 /* ClassDeclaration */); + var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { // If the source object isn't itself a class declaration, it can be freely assigned, regardless // of whether the constructed object is abstract or not. @@ -17578,8 +17589,8 @@ var ts; var targetErasedSignature = getErasedSignature(targetSig); var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212 /* ClassDeclaration */); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212 /* ClassDeclaration */); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { @@ -17928,6 +17939,7 @@ var ts; regularType.constructSignatures = type.constructSignatures; regularType.stringIndexType = type.stringIndexType; regularType.numberIndexType = type.numberIndexType; + type.regularType = regularType; } return regularType; } @@ -18949,7 +18961,7 @@ var ts; } } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } } return undefined; @@ -19307,11 +19319,12 @@ var ts; var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } + function hasDefaultValue(node) { + return (node.kind === 161 /* BindingElement */ && !!node.initializer) || + (node.kind === 179 /* BinaryExpression */ && node.operatorToken.kind === 55 /* EqualsToken */); + } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); @@ -19344,12 +19357,39 @@ var ts; hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; } if (!hasSpreadElement) { + // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such + // that we get the same behavior for "var [x, y] = []" and "[x, y] = []". + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } var contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting + // tuple type with the corresponding binding or assignment element types to make the lengths equal. + if (pattern && (pattern.kind === 160 /* ArrayBindingPattern */ || pattern.kind === 162 /* ArrayLiteralExpression */)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 185 /* OmittedExpression */) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); @@ -19407,6 +19447,9 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 159 /* ObjectBindingPattern */ || contextualType.pattern.kind === 163 /* ObjectLiteralExpression */); + var inDestructuringPattern = isAssignmentTarget(node); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; @@ -19427,6 +19470,24 @@ var ts; } typeFlags |= type.flags; var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + if (inDestructuringPattern) { + // If object literal is an assignment pattern and if the assignment pattern specifies a default value + // for the property, make the property optional. + if (memberDecl.kind === 243 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) { + prop.flags |= 536870912 /* Optional */; + } + } + else if (contextualTypeHasPattern) { + // If object literal is contextually typed by the implied type of a binding pattern, and if the + // binding pattern specifies a default value for the property, make the property optional. + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912 /* Optional */; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -19450,11 +19511,28 @@ var ts; } propertiesArray.push(member); } + // If object literal is contextually typed by the implied type of a binding pattern, augment the result + // type with those properties for which the binding pattern specifies a default value. + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912 /* Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -20963,7 +21041,7 @@ var ts; // Note, only class declarations can be declared abstract. // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212 /* ClassDeclaration */); + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & 256 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -24274,6 +24352,9 @@ var ts; // so we'll need to get back original 'target' symbol to work with correct set of flags return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { // TypeScript 1.0 spec (April 2014): 8.2.3 // A derived class inherits all members from its base class it doesn't override. @@ -24305,12 +24386,17 @@ var ts; // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { // derived class inherits base without override/redeclaration - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212 /* ClassDeclaration */); + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { - error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (derivedClassDecl.kind === 184 /* ClassExpression */) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -28622,6 +28708,8 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; + /** If removeComments is true, no leading-comments needed to be emitted **/ + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -30532,7 +30620,8 @@ var ts; operand.kind !== 178 /* PostfixUnaryExpression */ && operand.kind !== 167 /* NewExpression */ && !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && - !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */)) { + !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 164 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -31723,7 +31812,7 @@ var ts; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } // TODO (yuisu) : we should not have special cases to condition emitting comments // but have one place to fix check for these conditions. @@ -32149,7 +32238,7 @@ var ts; } else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { if (!member.body) { - return emitOnlyPinnedOrTripleSlashComments(member); + return emitCommentsOnNotEmittedNode(member); } writeLine(); emitLeadingComments(member); @@ -32215,7 +32304,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } else if (member.kind === 141 /* MethodDeclaration */ || member.kind === 143 /* GetAccessor */ || @@ -32266,7 +32355,7 @@ var ts; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { if (member.kind === 142 /* Constructor */ && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { @@ -33070,7 +33159,7 @@ var ts; return argumentsWritten; } function emitInterfaceDeclaration(node) { - emitOnlyPinnedOrTripleSlashComments(node); + emitCommentsOnNotEmittedNode(node); } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); @@ -33182,7 +33271,7 @@ var ts; // Emit only if this module is non-ambient. var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); @@ -34474,7 +34563,7 @@ var ts; function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { if (node.flags & 2 /* Ambient */) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { // This is the node that will handle its own comments and sourcemap @@ -34722,21 +34811,27 @@ var ts; } return leadingComments; } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } /** - * Removes all but the pinned or triple slash comments. - * @param ranges The array to be filtered - * @param onlyPinnedOrTripleSlashComments whether the filtering should be performed. - */ - function filterComments(ranges, onlyPinnedOrTripleSlashComments) { - // If we're removing comments, then we want to strip out all but the pinned or - // triple slash comments. - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = ts.filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(comment) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; } - return ranges; + return false; } function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments @@ -34761,23 +34856,46 @@ var ts; } } } - function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true); + /** + * Emit comments associated with node that will not be emitted into JS file + */ + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); } - function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { - // If the caller only wants pinned or triple slash comments, then always filter - // down to that set. Otherwise, filter based on the current compiler options. - var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + var trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } @@ -34787,11 +34905,17 @@ var ts; * ^ => pos; the function will emit "comment1" in the emitJS */ function emitTrailingCommentsOfPosition(pos) { - var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitLeadingCommentsOfPosition(pos) { + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } var leadingComments; if (hasDetachedComments(pos)) { // get comments without detached comments @@ -34801,13 +34925,26 @@ var ts; // get the leading comments from the node leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedComments(node) { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingComments; + if (compilerOptions.removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } if (leadingComments) { var detachedComments = []; var lastComment; @@ -34852,17 +34989,6 @@ var ts; write(shebang); } } - function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */ && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { - return true; - } - } } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -35139,7 +35265,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.6.2"; + ts.version = "1.7.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -35868,7 +35994,7 @@ var ts; if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { var start_3 = ts.getTokenPosOfNode(file.imports[i], file); @@ -36423,10 +36549,10 @@ var ts; * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName) { + function readConfigFile(fileName, readFile) { var text = ""; try { - text = ts.sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; @@ -39743,7 +39869,7 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */, 117 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); @@ -39767,7 +39893,7 @@ var ts; // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */, 130 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -39795,22 +39921,8 @@ var ts; this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117 /* AwaitKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117 /* AwaitKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // Type alias declaration - this.SpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130 /* TypeKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130 /* TypeKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // template string this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // type operation - this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45 /* AmpersandToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45 /* AmpersandToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39837,12 +39949,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword, - this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword, - this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, - this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, - this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, + this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -39937,6 +40045,8 @@ var ts; case 180 /* ConditionalExpression */: case 187 /* AsExpression */: case 148 /* TypePredicate */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) case 161 /* BindingElement */: @@ -40894,7 +41004,7 @@ var ts; } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind) { + getIndentationForComment: function (kind, tokenIndentation) { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -40902,9 +41012,10 @@ var ts; // } case 16 /* CloseBraceToken */: case 20 /* CloseBracketToken */: + case 18 /* CloseParenToken */: return indentation + delta; } - return indentation; + return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; }, getIndentationForToken: function (line, kind) { if (nodeStartLine !== line && node.decorators) { @@ -41106,8 +41217,12 @@ var ts; processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); } if (indentToken) { - var indentNextTokenOrTrivia = true; + var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + -1 /* Unknown */; if (currentTokenInfo.leadingTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + var indentNextTokenOrTrivia = true; for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { @@ -41115,14 +41230,12 @@ var ts; } switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: if (indentNextTokenOrTrivia) { - var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, /*lineAdded*/ false); + insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } break; @@ -41133,8 +41246,7 @@ var ts; } } // indent token only if is it is in target range and does not overlap with any error ranges - if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + if (tokenIndentation !== -1 /* Unknown */) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -46451,6 +46563,7 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; + case 184 /* ClassExpression */: case 212 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 4ce3cd34cb5..761ce39d418 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -1208,9 +1208,11 @@ declare namespace ts { UnionOrIntersection = 49152, StructuredType = 130048, } + type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { flags: TypeFlags; symbol?: Symbol; + pattern?: DestructuringPattern; } interface StringLiteralType extends Type { text: string; @@ -1237,7 +1239,6 @@ declare namespace ts { } interface TupleType extends ObjectType { elementTypes: Type[]; - baseArrayType: TypeReference; } interface UnionOrIntersectionType extends Type { types: Type[]; @@ -1532,7 +1533,7 @@ declare namespace ts { * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName: string): { + function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic; }; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index ebc0ba70357..2c70f56d0a6 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -2117,7 +2117,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -2288,6 +2288,7 @@ var ts; The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2300,8 +2301,10 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2494,6 +2497,11 @@ var ts; /// var ts; (function (ts) { + /* @internal */ + function tokenIsIdentifierOrKeyword(token) { + return token >= 67 /* Identifier */; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { "abstract": 113 /* AbstractKeyword */, "any": 115 /* AnyKeyword */, @@ -3929,7 +3937,7 @@ var ts; // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes function scanJsxIdentifier() { - if (token === 67 /* Identifier */) { + if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -5331,6 +5339,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { return true; @@ -8131,10 +8140,10 @@ var ts; return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName() { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || + return ts.tokenIsIdentifierOrKeyword(token) || token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */; } @@ -8154,7 +8163,7 @@ var ts; return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); } function isSimplePropertyName() { - return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || isIdentifierOrKeyword(); + return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { // PropertyName [Yield]: @@ -8270,9 +8279,9 @@ var ts; case 20 /* HeritageClauses */: return isHeritageClause(); case 21 /* ImportOrExportSpecifiers */: - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); case 13 /* JsxAttributes */: - return isIdentifierOrKeyword() || token === 15 /* OpenBraceToken */; + return ts.tokenIsIdentifierOrKeyword(token) || token === 15 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; case 22 /* JSDocFunctionParameters */: @@ -8305,7 +8314,7 @@ var ts; } function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { if (token === 104 /* ImplementsKeyword */ || @@ -8799,7 +8808,7 @@ var ts; // the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword". // In the first case though, ASI will not take effect because there is not a // line terminator after the identifier or keyword. - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { // Report that we need an identifier. However, report it right after the dot, @@ -9183,7 +9192,7 @@ var ts; return result; } } - if (isIdentifierOrKeyword()) { + if (ts.tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -10776,12 +10785,9 @@ var ts; return finishNode(expressionStatement); } } - function isIdentifierOrKeyword() { - return token >= 67 /* Identifier */; - } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); @@ -10789,7 +10795,7 @@ var ts; } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { @@ -10839,7 +10845,7 @@ var ts; case 87 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || isIdentifierOrKeyword(); + token === 15 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token); case 80 /* ExportKeyword */: nextToken(); if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || @@ -11379,7 +11385,7 @@ var ts; } // It is very important that we check this *after* checking indexers because // the [ token can start an index signature or a computed property name - if (isIdentifierOrKeyword() || + if (ts.tokenIsIdentifierOrKeyword(token) || token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || token === 37 /* AsteriskToken */ || @@ -11518,12 +11524,15 @@ var ts; } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { var node = createNode(216 /* ModuleDeclaration */, fullStart); + // If we are parsing a dotted namespace name, we want to + // propagate the 'Namespace' flag across the names if set. + var namespaceFlag = flags & 131072 /* Namespace */; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) : parseModuleBlock(); return finishNode(node); } @@ -11857,7 +11866,7 @@ var ts; case 95 /* ThisKeyword */: return true; } - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { @@ -13747,7 +13756,7 @@ var ts; // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } var isRelative = isExternalModuleNameRelative(moduleName); @@ -15051,7 +15060,7 @@ var ts; } // If the declaration specifies a binding pattern, use the type implied by the binding pattern if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ false); } // No type specified and nothing can be inferred return undefined; @@ -15059,45 +15068,45 @@ var ts; // Return the type implied by a binding pattern element. This is the type of the initializer of the element if // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding // pattern. Otherwise, it is the type any. - function getTypeFromBindingElement(element) { + function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (ts.isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } // Return the type implied by an object binding pattern - function getTypeFromObjectBindingPattern(pattern) { + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } // Return the type implied by an array binding pattern - function getTypeFromArrayBindingPattern(pattern) { - var hasSpreadElement = false; - var elementTypes = []; - ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 185 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - var unionOfElements = getUnionType(elementTypes); - return languageVersion >= 2 /* ES6 */ ? createIterableType(unionOfElements) : createArrayType(unionOfElements); - } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. + var elementTypes = ts.map(elements, function (e) { return e.kind === 185 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; + } return createTupleType(elementTypes); } // Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself @@ -15107,10 +15116,10 @@ var ts; // used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. - function getTypeFromBindingPattern(pattern) { + function getTypeFromBindingPattern(pattern, includePatternInType) { return pattern.kind === 159 /* ObjectBindingPattern */ - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } // Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type // specified in a type annotation or inferred from an initializer. However, in the case of a destructuring declaration it @@ -16578,11 +16587,11 @@ var ts; } function createTupleType(elementTypes) { var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } function getTypeFromTupleTypeNode(node) { @@ -17119,7 +17128,9 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & 49152 /* UnionOrIntersection */) { + source = getRegularTypeOfObjectLiteral(source); + } } var saveErrorInfo = errorInfo; // Note that the "each" checks must precede the "some" checks to produce the correct results @@ -17567,8 +17578,8 @@ var ts; return result; function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { if (sourceSig && targetSig) { - var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212 /* ClassDeclaration */); - var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212 /* ClassDeclaration */); + var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { // If the source object isn't itself a class declaration, it can be freely assigned, regardless // of whether the constructed object is abstract or not. @@ -17578,8 +17589,8 @@ var ts; var targetErasedSignature = getErasedSignature(targetSig); var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212 /* ClassDeclaration */); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212 /* ClassDeclaration */); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { @@ -17928,6 +17939,7 @@ var ts; regularType.constructSignatures = type.constructSignatures; regularType.stringIndexType = type.stringIndexType; regularType.numberIndexType = type.numberIndexType; + type.regularType = regularType; } return regularType; } @@ -18949,7 +18961,7 @@ var ts; } } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } } return undefined; @@ -19307,11 +19319,12 @@ var ts; var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } + function hasDefaultValue(node) { + return (node.kind === 161 /* BindingElement */ && !!node.initializer) || + (node.kind === 179 /* BinaryExpression */ && node.operatorToken.kind === 55 /* EqualsToken */); + } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); @@ -19344,12 +19357,39 @@ var ts; hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; } if (!hasSpreadElement) { + // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such + // that we get the same behavior for "var [x, y] = []" and "[x, y] = []". + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } var contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting + // tuple type with the corresponding binding or assignment element types to make the lengths equal. + if (pattern && (pattern.kind === 160 /* ArrayBindingPattern */ || pattern.kind === 162 /* ArrayLiteralExpression */)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 185 /* OmittedExpression */) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); @@ -19407,6 +19447,9 @@ var ts; var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 159 /* ObjectBindingPattern */ || contextualType.pattern.kind === 163 /* ObjectLiteralExpression */); + var inDestructuringPattern = isAssignmentTarget(node); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; @@ -19427,6 +19470,24 @@ var ts; } typeFlags |= type.flags; var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + if (inDestructuringPattern) { + // If object literal is an assignment pattern and if the assignment pattern specifies a default value + // for the property, make the property optional. + if (memberDecl.kind === 243 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) { + prop.flags |= 536870912 /* Optional */; + } + } + else if (contextualTypeHasPattern) { + // If object literal is contextually typed by the implied type of a binding pattern, and if the + // binding pattern specifies a default value for the property, make the property optional. + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912 /* Optional */; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -19450,11 +19511,28 @@ var ts; } propertiesArray.push(member); } + // If object literal is contextually typed by the implied type of a binding pattern, augment the result + // type with those properties for which the binding pattern specifies a default value. + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912 /* Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshObjectLiteral */; result.flags |= 524288 /* ObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -20963,7 +21041,7 @@ var ts; // Note, only class declarations can be declared abstract. // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212 /* ClassDeclaration */); + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & 256 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -24274,6 +24352,9 @@ var ts; // so we'll need to get back original 'target' symbol to work with correct set of flags return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { // TypeScript 1.0 spec (April 2014): 8.2.3 // A derived class inherits all members from its base class it doesn't override. @@ -24305,12 +24386,17 @@ var ts; // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { // derived class inherits base without override/redeclaration - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212 /* ClassDeclaration */); + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 256 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 256 /* Abstract */))) { - error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (derivedClassDecl.kind === 184 /* ClassExpression */) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -28622,6 +28708,8 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; + /** If removeComments is true, no leading-comments needed to be emitted **/ + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } @@ -30532,7 +30620,8 @@ var ts; operand.kind !== 178 /* PostfixUnaryExpression */ && operand.kind !== 167 /* NewExpression */ && !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && - !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */)) { + !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 164 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -31723,7 +31812,7 @@ var ts; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } // TODO (yuisu) : we should not have special cases to condition emitting comments // but have one place to fix check for these conditions. @@ -32149,7 +32238,7 @@ var ts; } else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { if (!member.body) { - return emitOnlyPinnedOrTripleSlashComments(member); + return emitCommentsOnNotEmittedNode(member); } writeLine(); emitLeadingComments(member); @@ -32215,7 +32304,7 @@ var ts; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } else if (member.kind === 141 /* MethodDeclaration */ || member.kind === 143 /* GetAccessor */ || @@ -32266,7 +32355,7 @@ var ts; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { if (member.kind === 142 /* Constructor */ && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); + emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { @@ -33070,7 +33159,7 @@ var ts; return argumentsWritten; } function emitInterfaceDeclaration(node) { - emitOnlyPinnedOrTripleSlashComments(node); + emitCommentsOnNotEmittedNode(node); } function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); @@ -33182,7 +33271,7 @@ var ts; // Emit only if this module is non-ambient. var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); @@ -34474,7 +34563,7 @@ var ts; function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { if (node) { if (node.flags & 2 /* Ambient */) { - return emitOnlyPinnedOrTripleSlashComments(node); + return emitCommentsOnNotEmittedNode(node); } if (isSpecializedCommentHandling(node)) { // This is the node that will handle its own comments and sourcemap @@ -34722,21 +34811,27 @@ var ts; } return leadingComments; } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + } /** - * Removes all but the pinned or triple slash comments. - * @param ranges The array to be filtered - * @param onlyPinnedOrTripleSlashComments whether the filtering should be performed. - */ - function filterComments(ranges, onlyPinnedOrTripleSlashComments) { - // If we're removing comments, then we want to strip out all but the pinned or - // triple slash comments. - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = ts.filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(comment) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; } - return ranges; + return false; } function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments @@ -34761,23 +34856,46 @@ var ts; } } } - function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true); + /** + * Emit comments associated with node that will not be emitted into JS file + */ + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); } - function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { - // If the caller only wants pinned or triple slash comments, then always filter - // down to that set. Otherwise, filter based on the current compiler options. - var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); } function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + var trailingComments = getTrailingCommentsToEmit(node); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } @@ -34787,11 +34905,17 @@ var ts; * ^ => pos; the function will emit "comment1" in the emitJS */ function emitTrailingCommentsOfPosition(pos) { - var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } - function emitLeadingCommentsOfPosition(pos) { + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } var leadingComments; if (hasDetachedComments(pos)) { // get comments without detached comments @@ -34801,13 +34925,26 @@ var ts; // get the leading comments from the node leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedComments(node) { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + var leadingComments; + if (compilerOptions.removeComments) { + // removeComments is true, only reserve pinned comment at the top of file + // For example: + // /*! Pinned Comment */ + // + // var x = 10; + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + // removeComments is false, just get detached as normal and bypass the process to filter comment + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } if (leadingComments) { var detachedComments = []; var lastComment; @@ -34852,17 +34989,6 @@ var ts; write(shebang); } } - function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; - } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */ && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { - return true; - } - } } function emitFile(jsFilePath, sourceFile) { emitJavaScript(jsFilePath, sourceFile); @@ -35139,7 +35265,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.6.2"; + ts.version = "1.7.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -35868,7 +35994,7 @@ var ts; if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { var start_3 = ts.getTokenPosOfNode(file.imports[i], file); @@ -36423,10 +36549,10 @@ var ts; * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName) { + function readConfigFile(fileName, readFile) { var text = ""; try { - text = ts.sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; @@ -39743,7 +39869,7 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */, 117 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); @@ -39767,7 +39893,7 @@ var ts; // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */, 130 /* TypeKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -39795,22 +39921,8 @@ var ts; this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116 /* AsyncKeyword */, 85 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117 /* AwaitKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117 /* AwaitKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // Type alias declaration - this.SpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130 /* TypeKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130 /* TypeKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // template string this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // type operation - this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46 /* BarToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46 /* BarToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45 /* AmpersandToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45 /* AmpersandToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -39837,12 +39949,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword, - this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword, - this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, - this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, - this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, + this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, // TypeScript-specific rules this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, @@ -39937,6 +40045,8 @@ var ts; case 180 /* ConditionalExpression */: case 187 /* AsExpression */: case 148 /* TypePredicate */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) case 161 /* BindingElement */: @@ -40894,7 +41004,7 @@ var ts; } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind) { + getIndentationForComment: function (kind, tokenIndentation) { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -40902,9 +41012,10 @@ var ts; // } case 16 /* CloseBraceToken */: case 20 /* CloseBracketToken */: + case 18 /* CloseParenToken */: return indentation + delta; } - return indentation; + return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; }, getIndentationForToken: function (line, kind) { if (nodeStartLine !== line && node.decorators) { @@ -41106,8 +41217,12 @@ var ts; processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); } if (indentToken) { - var indentNextTokenOrTrivia = true; + var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + -1 /* Unknown */; if (currentTokenInfo.leadingTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + var indentNextTokenOrTrivia = true; for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { @@ -41115,14 +41230,12 @@ var ts; } switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: if (indentNextTokenOrTrivia) { - var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, /*lineAdded*/ false); + insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } break; @@ -41133,8 +41246,7 @@ var ts; } } // indent token only if is it is in target range and does not overlap with any error ranges - if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + if (tokenIndentation !== -1 /* Unknown */) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -46451,6 +46563,7 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; + case 184 /* ClassExpression */: case 212 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. From 5b5d876cc215b4196fd8f2931bc0ec1a54c16a4e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 15 Sep 2015 17:47:50 -0700 Subject: [PATCH 43/75] more code review comments --- src/harness/rwcRunner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index c6637562ce5..1e81392049d 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -84,9 +84,9 @@ module RWC { } // Load the files - ts.forEach(fileNames, fileName => { + for (let fileName of fileNames) { inputFiles.push(getHarnessCompilerInputUnit(fileName)); - }); + } // Add files to compilation let isInInputList = (resolvedPath: string) => (inputFile: { unitName: string; content: string; }) => inputFile.unitName === resolvedPath; From 32048ca5ac45a6855484178ba86f294828d16e6a Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Wed, 16 Sep 2015 10:57:54 +1000 Subject: [PATCH 44/75] fix types : export the base as children are exported --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index fd9adc331d3..d2757bb7937 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2116,7 +2116,7 @@ namespace ts { } /* @internal */ - interface CommandLineOptionBase { + export interface CommandLineOptionBase { name: string; type: string | Map; // "string", "number", "boolean", or an object literal mapping named values to actual values isFilePath?: boolean; // True if option value is a path or fileName From a2d7b0948880b53ab1d1486624d44d7ead88d8b5 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 16 Sep 2015 15:47:52 -0700 Subject: [PATCH 45/75] failing test --- .../reference/es3defaultAliasIsQuoted.js | 33 +++++++++++++++++ .../reference/es3defaultAliasIsQuoted.symbols | 30 +++++++++++++++ .../reference/es3defaultAliasIsQuoted.types | 37 +++++++++++++++++++ .../cases/compiler/es3defaultAliasIsQuoted.ts | 15 ++++++++ 4 files changed, 115 insertions(+) create mode 100644 tests/baselines/reference/es3defaultAliasIsQuoted.js create mode 100644 tests/baselines/reference/es3defaultAliasIsQuoted.symbols create mode 100644 tests/baselines/reference/es3defaultAliasIsQuoted.types create mode 100644 tests/cases/compiler/es3defaultAliasIsQuoted.ts diff --git a/tests/baselines/reference/es3defaultAliasIsQuoted.js b/tests/baselines/reference/es3defaultAliasIsQuoted.js new file mode 100644 index 00000000000..3ca828c1b4c --- /dev/null +++ b/tests/baselines/reference/es3defaultAliasIsQuoted.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/es3defaultAliasIsQuoted.ts] //// + +//// [es3defaultAliasQuoted_file0.ts] + +export class Foo { + static CONSTANT = "Foo"; +} + +export default function assert(value: boolean) { + if (!value) throw new Error("Assertion failed!"); +} + +//// [es3defaultAliasQuoted_file1.ts] +import {Foo, default as assert} from "./es3defaultAliasQuoted_file0"; +assert(Foo.CONSTANT === "Foo"); + +//// [es3defaultAliasQuoted_file0.js] +var Foo = (function () { + function Foo() { + } + Foo.CONSTANT = "Foo"; + return Foo; +})(); +exports.Foo = Foo; +function assert(value) { + if (!value) + throw new Error("Assertion failed!"); +} +exports.__esModule = true; +exports["default"] = assert; +//// [es3defaultAliasQuoted_file1.js] +var es3defaultAliasQuoted_file0_1 = require("./es3defaultAliasQuoted_file0"); +es3defaultAliasQuoted_file0_1["default"](es3defaultAliasQuoted_file0_1.Foo.CONSTANT === "Foo"); diff --git a/tests/baselines/reference/es3defaultAliasIsQuoted.symbols b/tests/baselines/reference/es3defaultAliasIsQuoted.symbols new file mode 100644 index 00000000000..907f1d71b89 --- /dev/null +++ b/tests/baselines/reference/es3defaultAliasIsQuoted.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/es3defaultAliasQuoted_file0.ts === + +export class Foo { +>Foo : Symbol(Foo, Decl(es3defaultAliasQuoted_file0.ts, 0, 0)) + + static CONSTANT = "Foo"; +>CONSTANT : Symbol(Foo.CONSTANT, Decl(es3defaultAliasQuoted_file0.ts, 1, 18)) +} + +export default function assert(value: boolean) { +>assert : Symbol(assert, Decl(es3defaultAliasQuoted_file0.ts, 3, 1)) +>value : Symbol(value, Decl(es3defaultAliasQuoted_file0.ts, 5, 31)) + + if (!value) throw new Error("Assertion failed!"); +>value : Symbol(value, Decl(es3defaultAliasQuoted_file0.ts, 5, 31)) +>Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11)) +} + +=== tests/cases/compiler/es3defaultAliasQuoted_file1.ts === +import {Foo, default as assert} from "./es3defaultAliasQuoted_file0"; +>Foo : Symbol(Foo, Decl(es3defaultAliasQuoted_file1.ts, 0, 8)) +>default : Symbol(assert, Decl(es3defaultAliasQuoted_file1.ts, 0, 12)) +>assert : Symbol(assert, Decl(es3defaultAliasQuoted_file1.ts, 0, 12)) + +assert(Foo.CONSTANT === "Foo"); +>assert : Symbol(assert, Decl(es3defaultAliasQuoted_file1.ts, 0, 12)) +>Foo.CONSTANT : Symbol(Foo.CONSTANT, Decl(es3defaultAliasQuoted_file0.ts, 1, 18)) +>Foo : Symbol(Foo, Decl(es3defaultAliasQuoted_file1.ts, 0, 8)) +>CONSTANT : Symbol(Foo.CONSTANT, Decl(es3defaultAliasQuoted_file0.ts, 1, 18)) + diff --git a/tests/baselines/reference/es3defaultAliasIsQuoted.types b/tests/baselines/reference/es3defaultAliasIsQuoted.types new file mode 100644 index 00000000000..d3b1ebf105b --- /dev/null +++ b/tests/baselines/reference/es3defaultAliasIsQuoted.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/es3defaultAliasQuoted_file0.ts === + +export class Foo { +>Foo : Foo + + static CONSTANT = "Foo"; +>CONSTANT : string +>"Foo" : string +} + +export default function assert(value: boolean) { +>assert : (value: boolean) => void +>value : boolean + + if (!value) throw new Error("Assertion failed!"); +>!value : boolean +>value : boolean +>new Error("Assertion failed!") : Error +>Error : ErrorConstructor +>"Assertion failed!" : string +} + +=== tests/cases/compiler/es3defaultAliasQuoted_file1.ts === +import {Foo, default as assert} from "./es3defaultAliasQuoted_file0"; +>Foo : typeof Foo +>default : (value: boolean) => void +>assert : (value: boolean) => void + +assert(Foo.CONSTANT === "Foo"); +>assert(Foo.CONSTANT === "Foo") : void +>assert : (value: boolean) => void +>Foo.CONSTANT === "Foo" : boolean +>Foo.CONSTANT : string +>Foo : typeof Foo +>CONSTANT : string +>"Foo" : string + diff --git a/tests/cases/compiler/es3defaultAliasIsQuoted.ts b/tests/cases/compiler/es3defaultAliasIsQuoted.ts new file mode 100644 index 00000000000..ccaa0268906 --- /dev/null +++ b/tests/cases/compiler/es3defaultAliasIsQuoted.ts @@ -0,0 +1,15 @@ +// @module: commonjs +// @target: es3 + +// @Filename: es3defaultAliasQuoted_file0.ts +export class Foo { + static CONSTANT = "Foo"; +} + +export default function assert(value: boolean) { + if (!value) throw new Error("Assertion failed!"); +} + +// @Filename: es3defaultAliasQuoted_file1.ts +import {Foo, default as assert} from "./es3defaultAliasQuoted_file0"; +assert(Foo.CONSTANT === "Foo"); \ No newline at end of file From 1500f5cd029e849de938a93ce8bc5690fe7179fd Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Sep 2015 17:28:30 -0700 Subject: [PATCH 46/75] Moved importDefinitelyTypedTests.ts to its own folder. --- .../importDefinitelyTypedTests.ts | 3 --- 1 file changed, 3 deletions(-) rename scripts/{ => importDefinitelyTypedTests}/importDefinitelyTypedTests.ts (95%) diff --git a/scripts/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts similarity index 95% rename from scripts/importDefinitelyTypedTests.ts rename to scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index f33ba1dd525..518fbed87b8 100644 --- a/scripts/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -1,6 +1,3 @@ -declare var require: any, process: any; -declare var __dirname: any; - var fs = require("fs"); var path = require("path"); var child_process = require('child_process'); From 5dfca610f9ec5ffebba6967b9e45f0a66b09edce Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 16 Sep 2015 17:33:49 -0700 Subject: [PATCH 47/75] When targeting ES3 emit default alias as indexer --- src/compiler/emitter.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 44e5a45b057..8928e437622 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1515,8 +1515,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else if (declaration.kind === SyntaxKind.ImportSpecifier) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, (declaration).propertyName || (declaration).name); + var name = (declaration).propertyName || (declaration).name; + var identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + if (languageVersion == ScriptTarget.ES3 && identifier === "default") { + write(`["default"]`); + } else { + write("."); + write(identifier); + } return; } } From 9696e5777253e397b151816c31d8a780776027d5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Sep 2015 17:34:31 -0700 Subject: [PATCH 48/75] Added tsd.json file with 'node.d.ts'. --- scripts/tsd.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 scripts/tsd.json diff --git a/scripts/tsd.json b/scripts/tsd.json new file mode 100644 index 00000000000..c2fc88a0b0f --- /dev/null +++ b/scripts/tsd.json @@ -0,0 +1,12 @@ +{ + "version": "v4", + "repo": "borisyankov/DefinitelyTyped", + "ref": "master", + "path": "typings", + "bundle": "typings/tsd.d.ts", + "installed": { + "node/node.d.ts": { + "commit": "5f480287834a2615274eea31574b713e64decf17" + } + } +} From a47b7b8f1764afeed1a520e6bdab25a4e29788e3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Sep 2015 17:35:18 -0700 Subject: [PATCH 49/75] Added 'tsconfig.json' for 'importDefinitelyTypedTests' script. --- scripts/importDefinitelyTypedTests/tsconfig.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/importDefinitelyTypedTests/tsconfig.json diff --git a/scripts/importDefinitelyTypedTests/tsconfig.json b/scripts/importDefinitelyTypedTests/tsconfig.json new file mode 100644 index 00000000000..3bf148ffa5c --- /dev/null +++ b/scripts/importDefinitelyTypedTests/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es3", + "noImplicitAny": true, + "outDir": "./", + "rootDir": ".", + "sourceMap": false + }, + "files": [ + "../typings/node/node.d.ts", + "importDefinitelyTypedTests.ts" + ], + "exclude": [ + ] +} \ No newline at end of file From 8bb6313b22b9b7a0c1d5b0d04156589d181e64e3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Sep 2015 17:42:32 -0700 Subject: [PATCH 50/75] Use explicit types, var -> let/const, misspellings, style. --- .../importDefinitelyTypedTests.ts | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index 518fbed87b8..fa935c2fa31 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -1,29 +1,41 @@ -var fs = require("fs"); -var path = require("path"); -var child_process = require('child_process'); +import * as fs from "fs"; +import * as path from "path"; +import * as child_process from "child_process"; -var tscRoot = path.join(__dirname, "..\\"); -var tscPath = path.join(tscRoot, "built", "instrumented", "tsc.js"); -var rwcTestPath = path.join(tscRoot, "tests", "cases", "rwc", "dt"); -var definitelyTypedRoot = process.argv[2]; +interface Map { + [key: string]: T; +} + +declare const __dirname: string; +declare const process: { + argv: string[]; + env: Map +} + +const tscRoot = path.join(__dirname, "..\\"); +const tscPath = path.join(tscRoot, "built", "instrumented", "tsc.js"); +const rwcTestPath = path.join(tscRoot, "tests", "cases", "rwc", "dt"); +const definitelyTypedRoot = process.argv[2]; function fileExtensionIs(path: string, extension: string): boolean { - var pathLen = path.length; - var extLen = extension.length; + const pathLen = path.length; + const extLen = extension.length; return pathLen > extLen && path.substr(pathLen - extLen, extLen).toLocaleLowerCase() === extension.toLocaleLowerCase(); } -function copyFileSync(source, destination) { - var text = fs.readFileSync(source); +function copyFileSync(source: string, destination: string) { + let text = fs.readFileSync(source); fs.writeFileSync(destination, text); } function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], responseFile: string ) { - var cmd = "node " + tscPath + " --module commonjs " + testFiles.join(" "); - if (responseFile) cmd += " @" + responseFile; + let cmd = "node " + tscPath + " --module commonjs " + testFiles.join(" "); + if (responseFile) { + cmd += " @" + responseFile; + } - var testDirectoryName = testCaseName + "_" + Math.floor((Math.random() * 10000) + 1); - var testDirectoryPath = path.join(process.env["temp"], testDirectoryName); + let testDirectoryName = testCaseName + "_" + Math.floor((Math.random() * 10000) + 1); + let testDirectoryPath = path.join(process.env["temp"], testDirectoryName); if (fs.existsSync(testDirectoryPath)) { throw new Error("Could not create test directory"); } @@ -47,8 +59,8 @@ function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], re } // copy generated file to output location - var outputFilePath = path.join(testDirectoryPath, "iocapture0.json"); - var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json"); + let outputFilePath = path.join(testDirectoryPath, "iocapture0.json"); + let testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json"); copyFileSync(outputFilePath, testCasePath); //console.log("output generated at: " + outputFilePath); @@ -65,28 +77,32 @@ function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], re //console.log("\r\n"); }) - .on('error', function (error) { + .on('error', (error: any) => { console.log("==> error " + JSON.stringify(error)); console.log("\r\n"); }); } function importDefinitelyTypedTests(definitelyTypedRoot: string): void { - fs.readdir(definitelyTypedRoot, (err, subDirectorys) => { - if (err) throw err; + fs.readdir(definitelyTypedRoot, (err, subDirectories) => { + if (err) { + throw err; + } - subDirectorys + subDirectories .filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0) .filter(i => i.indexOf("sipml") >=0 ) .filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory()) .forEach(d => { - var directoryPath = path.join(definitelyTypedRoot, d); + let directoryPath = path.join(definitelyTypedRoot, d); fs.readdir(directoryPath, function (err, files) { - if (err) throw err; + if (err) { + throw err; + } - var tsFiles = []; - var testFiles = []; - var paramFile; + let tsFiles: string[] = []; + let testFiles: string[] = []; + let paramFile: string; files .map(f => path.join(directoryPath, f)) @@ -99,7 +115,7 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void { if (testFiles.length === 0) { // no test files but multiple d.ts's, e.g. winjs - var regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); + let regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); if (tsFiles.length > 1 && tsFiles.every(t => fileExtensionIs(t, ".d.ts") && regexp.test(t))) { tsFiles.forEach(filename => { importDefinitelyTypedTest(path.basename(filename, ".d.ts"), [filename], paramFile); From 1ab10adbdcda1c6c0d7c15e932a7f89ce14cbcb8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 00:53:17 -0700 Subject: [PATCH 51/75] Added tests. --- ...TypedClassExpressionMethodDeclaration01.ts | 47 +++++++++++++++++ ...TypedClassExpressionMethodDeclaration02.ts | 51 +++++++++++++++++++ ...lyTypedObjectLiteralMethodDeclaration01.ts | 47 +++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts create mode 100644 tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts create mode 100644 tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts diff --git a/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts new file mode 100644 index 00000000000..7ceb5bd34bc --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts @@ -0,0 +1,47 @@ +// @noImplicitAny: true + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return class { + static method1(arg) { + arg.numProp = 10; + } + static method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return class { + static method1 = (arg) => { + arg.numProp = 10; + } + static method2 = (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return class { + static method1 = function (arg) { + arg.numProp = 10; + } + static method2 = function (arg) { + arg.strProp = "hello"; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts new file mode 100644 index 00000000000..2f1f6f079c8 --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts @@ -0,0 +1,51 @@ +// @noImplicitAny: true + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + new (): Bar; +} + +interface Bar { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return class { + method1(arg) { + arg.numProp = 10; + } + method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return class { + method1 = (arg) => { + arg.numProp = 10; + } + method2 = (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return class { + method1 = function (arg) { + arg.numProp = 10; + } + method2 = function (arg) { + arg.strProp = "hello"; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts new file mode 100644 index 00000000000..ed8912317fe --- /dev/null +++ b/tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts @@ -0,0 +1,47 @@ +// @noImplicitAny: true + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return { + method1(arg) { + arg.numProp = 10; + }, + method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return { + method1: (arg) => { + arg.numProp = 10; + }, + method2: (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return { + method1: function (arg) { + arg.numProp = 10; + }, + method2: function (arg) { + arg.strProp = "hello"; + } + } +} \ No newline at end of file From f3062c59fded3c23d7523b8879b6f997489665ef Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 Sep 2015 13:03:47 -0700 Subject: [PATCH 52/75] style nits --- src/compiler/emitter.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8928e437622..bd16b13bb09 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1517,9 +1517,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(getGeneratedNameForNode(declaration.parent.parent.parent)); var name = (declaration).propertyName || (declaration).name; var identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name); - if (languageVersion == ScriptTarget.ES3 && identifier === "default") { + if (languageVersion === ScriptTarget.ES3 && identifier === "default") { write(`["default"]`); - } else { + } + else { write("."); write(identifier); } From 2793bc2acda93a6d84cf1db19eab98d37a7b8271 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 Sep 2015 14:29:52 -0700 Subject: [PATCH 53/75] Feedback from PR, remove unused identifiers --- scripts/tslint/nextLineRule.ts | 14 ++++++-------- scripts/tslint/noInferrableTypesRule.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/tslint/nextLineRule.ts b/scripts/tslint/nextLineRule.ts index 8e24aea45e5..7eec75a1baf 100644 --- a/scripts/tslint/nextLineRule.ts +++ b/scripts/tslint/nextLineRule.ts @@ -24,9 +24,9 @@ class NextLineWalker extends Lint.RuleWalker { const elseKeyword = getFirstChildOfKind(node, ts.SyntaxKind.ElseKeyword); if (this.hasOption(OPTION_ELSE) && !!elseKeyword) { const thenStatementEndLoc = sourceFile.getLineAndCharacterOfPosition(thenStatement.getEnd()); - const elseKeywordLoc = sourceFile.getLineAndCharacterOfPosition(elseKeyword.getStart()); + const elseKeywordLoc = sourceFile.getLineAndCharacterOfPosition(elseKeyword.getStart(sourceFile)); if (thenStatementEndLoc.line !== (elseKeywordLoc.line - 1)) { - const failure = this.createFailure(elseKeyword.getStart(), elseKeyword.getWidth(), Rule.ELSE_FAILURE_STRING); + const failure = this.createFailure(elseKeyword.getStart(sourceFile), elseKeyword.getWidth(sourceFile), Rule.ELSE_FAILURE_STRING); this.addFailure(failure); } } @@ -40,17 +40,15 @@ class NextLineWalker extends Lint.RuleWalker { const catchClause = node.catchClause; // "visit" try block - const tryKeyword = node.getChildAt(0); const tryBlock = node.tryBlock; - const tryOpeningBrace = tryBlock.getChildAt(0); if (this.hasOption(OPTION_CATCH) && !!catchClause) { - const tryClosingBrace = node.tryBlock.getChildAt(node.tryBlock.getChildCount() - 1); - const catchKeyword = catchClause.getChildAt(0); + const tryClosingBrace = tryBlock.getLastToken(sourceFile); + const catchKeyword = catchClause.getFirstToken(sourceFile); const tryClosingBraceLoc = sourceFile.getLineAndCharacterOfPosition(tryClosingBrace.getEnd()); - const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart()); + const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart(sourceFile)); if (tryClosingBraceLoc.line !== (catchKeywordLoc.line - 1)) { - const failure = this.createFailure(catchKeyword.getStart(), catchKeyword.getWidth(), Rule.CATCH_FAILURE_STRING); + const failure = this.createFailure(catchKeyword.getStart(sourceFile), catchKeyword.getWidth(sourceFile), Rule.CATCH_FAILURE_STRING); this.addFailure(failure); } } diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts index 1dae47971eb..cbc0162260e 100644 --- a/scripts/tslint/noInferrableTypesRule.ts +++ b/scripts/tslint/noInferrableTypesRule.ts @@ -27,8 +27,14 @@ class InferrableTypeWalker extends Lint.RuleWalker { } break; case ts.SyntaxKind.StringKeyword: - if (e.initializer.kind === ts.SyntaxKind.StringLiteral || e.initializer.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) { - failure = 'string'; + switch (e.initializer.kind) { + case ts.SyntaxKind.StringLiteral: + case ts.SyntaxKind.NoSubstitutionTemplateLiteral: + case ts.SyntaxKind.TemplateExpression: + failure = 'string'; + break; + default: + break; } break; } From 6969986bf0a3721845a0dff8eee706a75948968b Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 31 Aug 2015 14:54:01 -0700 Subject: [PATCH 54/75] Use intersection types in Object.assing defintion --- src/lib/es6.d.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index c07d047b58e..d44b6c0f41a 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -121,6 +121,33 @@ interface Object { } interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source source objects to copy properties from. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 first source objects to copy properties from. + * @param source2 second source objects to copy properties from. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 first source objects to copy properties from. + * @param source2 second source objects to copy properties from. + * @param source3 second source objects to copy properties from. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + /** * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. From 98db640a2c7dfe72b5392d7aeeb535264eaaedb1 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 31 Aug 2015 15:17:02 -0700 Subject: [PATCH 55/75] Fix documentation --- src/lib/es6.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index d44b6c0f41a..e2b26747516 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -125,7 +125,7 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param source source objects to copy properties from. + * @param source The source object from which to copy properties. */ assign(target: T, source: U): T & U; @@ -133,8 +133,8 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param source1 first source objects to copy properties from. - * @param source2 second source objects to copy properties from. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. */ assign(target: T, source1: U, source2: V): T & U & V; @@ -142,9 +142,9 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param source1 first source objects to copy properties from. - * @param source2 second source objects to copy properties from. - * @param source3 second source objects to copy properties from. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. */ assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; @@ -152,7 +152,7 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; From 1e0b9cab45b7318b939f4ec1df4653145cf03ab6 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 31 Aug 2015 16:12:45 -0700 Subject: [PATCH 56/75] accept baselines --- .../reference/arrayLiterals2ES6.symbols | 6 +- .../reference/asyncArrowFunction1_es6.symbols | 2 +- .../reference/asyncAwait_es6.symbols | 20 +- .../asyncFunctionDeclaration11_es6.symbols | 2 +- .../asyncFunctionDeclaration14_es6.symbols | 2 +- .../asyncFunctionDeclaration1_es6.symbols | 2 +- .../awaitBinaryExpression1_es6.symbols | 4 +- .../awaitBinaryExpression2_es6.symbols | 4 +- .../awaitBinaryExpression3_es6.symbols | 4 +- .../awaitBinaryExpression4_es6.symbols | 4 +- .../awaitBinaryExpression5_es6.symbols | 4 +- .../awaitCallExpression1_es6.symbols | 8 +- .../awaitCallExpression2_es6.symbols | 8 +- .../awaitCallExpression3_es6.symbols | 8 +- .../awaitCallExpression4_es6.symbols | 8 +- .../awaitCallExpression5_es6.symbols | 8 +- .../awaitCallExpression6_es6.symbols | 8 +- .../awaitCallExpression7_es6.symbols | 8 +- .../awaitCallExpression8_es6.symbols | 8 +- .../reference/callWithSpreadES6.symbols | 2 +- ...tructuringParameterDeclaration3ES5.symbols | 16 +- ...tructuringParameterDeclaration3ES6.symbols | 16 +- ...owFunctionWhenUsingArguments14_ES6.symbols | 2 +- ...owFunctionWhenUsingArguments15_ES6.symbols | 2 +- ...owFunctionWhenUsingArguments16_ES6.symbols | 2 +- ...owFunctionWhenUsingArguments17_ES6.symbols | 2 +- ...owFunctionWhenUsingArguments18_ES6.symbols | 2 +- tests/baselines/reference/for-of13.symbols | 4 +- tests/baselines/reference/for-of37.symbols | 2 +- tests/baselines/reference/for-of38.symbols | 2 +- tests/baselines/reference/for-of40.symbols | 2 +- tests/baselines/reference/for-of45.symbols | 2 +- tests/baselines/reference/for-of50.symbols | 2 +- tests/baselines/reference/for-of57.symbols | 2 +- .../reference/generatorOverloads4.symbols | 6 +- .../reference/generatorOverloads5.symbols | 6 +- .../reference/generatorTypeCheck1.symbols | 2 +- .../reference/generatorTypeCheck10.symbols | 2 +- .../reference/generatorTypeCheck11.symbols | 2 +- .../reference/generatorTypeCheck12.symbols | 2 +- .../reference/generatorTypeCheck13.symbols | 2 +- .../reference/generatorTypeCheck17.symbols | 2 +- .../reference/generatorTypeCheck19.symbols | 2 +- .../reference/generatorTypeCheck2.symbols | 2 +- .../reference/generatorTypeCheck26.symbols | 2 +- .../reference/generatorTypeCheck27.symbols | 2 +- .../reference/generatorTypeCheck28.symbols | 2 +- .../reference/generatorTypeCheck29.symbols | 4 +- .../reference/generatorTypeCheck3.symbols | 2 +- .../reference/generatorTypeCheck30.symbols | 4 +- .../reference/generatorTypeCheck45.symbols | 2 +- .../reference/generatorTypeCheck46.symbols | 2 +- .../reference/iterableArrayPattern30.symbols | 2 +- .../iterableContextualTyping1.symbols | 2 +- .../reference/iteratorSpreadInArray11.symbols | 2 +- .../promiseVoidErrorCallback.symbols | 16 +- .../reference/stringIncludes.symbols | 8 +- ...teStringWithEmbeddedNewOperatorES6.symbols | 2 +- ...typeArgumentInferenceApparentType1.symbols | 2 +- ...typeArgumentInferenceApparentType2.symbols | 4 +- tests/baselines/reference/typedArrays.symbols | 288 +++++++++--------- 61 files changed, 276 insertions(+), 276 deletions(-) diff --git a/tests/baselines/reference/arrayLiterals2ES6.symbols b/tests/baselines/reference/arrayLiterals2ES6.symbols index fd31800e840..75202d69690 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.symbols +++ b/tests/baselines/reference/arrayLiterals2ES6.symbols @@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3)) diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.symbols b/tests/baselines/reference/asyncArrowFunction1_es6.symbols index 0da7c4433b3..349a51c43ba 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es6.symbols @@ -2,6 +2,6 @@ var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) }; diff --git a/tests/baselines/reference/asyncAwait_es6.symbols b/tests/baselines/reference/asyncAwait_es6.symbols index 6f492b07d1b..2eb28e12211 100644 --- a/tests/baselines/reference/asyncAwait_es6.symbols +++ b/tests/baselines/reference/asyncAwait_es6.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31)) @@ -92,7 +92,7 @@ class C { async m2(): Promise { } >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30)) @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols index f7574402c80..b970dbbf888 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols index 97dc419ba47..d17f4bf899e 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols index 35e4394c82d..c99ae35266b 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) } diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols index b91d8bf9492..5203e666db9 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = await p || a; diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols index 60127a06b90..da1efd0fda4 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = await p && a; diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols index 83f006bc285..e35d1663486 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols @@ -4,11 +4,11 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = await p + a; diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols index 38e9ccfe608..19dd741e2db 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = await p, a; diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols index 161d697b75b..4cc5914692b 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var o: { a: boolean; }; diff --git a/tests/baselines/reference/awaitCallExpression1_es6.symbols b/tests/baselines/reference/awaitCallExpression1_es6.symbols index 8c6494d34af..d70728a5b2d 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols index db8cff67f01..1ce953f5367 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols index e2b0e8a9137..ea9c6934502 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols index 75067422152..f35e690bc6e 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = (await pfn)(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression5_es6.symbols b/tests/baselines/reference/awaitCallExpression5_es6.symbols index d9c9cb9ed9a..4c75a6fec6d 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = o.fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols index ee9779e68e8..0a053d172a0 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = o.fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols index 51ce2db20a2..41dd8bcaff9 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = o.fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols index be3a841cce1..caaf10d4dba 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) "before"; var b = (await po).fn(a, a, a); diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index 8e84f48948f..d8604d8358a 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4009, 1)) +>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4036, 1)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3)) >foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols index 24774958941..c2130f060ab 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols @@ -8,18 +8,18 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) function a1(...x: (number|string)[]) { } @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols index e8cfc29f3a0..976c402d2b0 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols @@ -8,18 +8,18 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) function a1(...x: (number|string)[]) { } @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4091, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4118, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index e5275396346..3e7770ccdda 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -5,7 +5,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4392, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4419, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) let arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index 230e7158d32..c0ea901fbbf 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4392, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4419, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) const arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index e304c33e48e..3d09056c8c3 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4392, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4419, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index 4a309471e64..22431e495cc 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -9,7 +9,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4392, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4419, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols index e9760caa319..6dbbe9501d0 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols @@ -10,7 +10,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4392, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4419, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments; diff --git a/tests/baselines/reference/for-of13.symbols b/tests/baselines/reference/for-of13.symbols index e465f36a50f..09a7e06cc21 100644 --- a/tests/baselines/reference/for-of13.symbols +++ b/tests/baselines/reference/for-of13.symbols @@ -4,6 +4,6 @@ var v: string; for (v of [""].values()) { } >v : Symbol(v, Decl(for-of13.ts, 0, 3)) ->[""].values : Symbol(Array.values, Decl(lib.d.ts, 4119, 37)) ->values : Symbol(Array.values, Decl(lib.d.ts, 4119, 37)) +>[""].values : Symbol(Array.values, Decl(lib.d.ts, 4146, 37)) +>values : Symbol(Array.values, Decl(lib.d.ts, 4146, 37)) diff --git a/tests/baselines/reference/for-of37.symbols b/tests/baselines/reference/for-of37.symbols index e6a10d77cad..b0a39571f6f 100644 --- a/tests/baselines/reference/for-of37.symbols +++ b/tests/baselines/reference/for-of37.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of37.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of37.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) for (var v of map) { >v : Symbol(v, Decl(for-of37.ts, 1, 8)) diff --git a/tests/baselines/reference/for-of38.symbols b/tests/baselines/reference/for-of38.symbols index 43df250ab95..67ee08bbb5f 100644 --- a/tests/baselines/reference/for-of38.symbols +++ b/tests/baselines/reference/for-of38.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of38.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of38.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) for (var [k, v] of map) { >k : Symbol(k, Decl(for-of38.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of40.symbols b/tests/baselines/reference/for-of40.symbols index e1e413424ad..2f3a2a9a574 100644 --- a/tests/baselines/reference/for-of40.symbols +++ b/tests/baselines/reference/for-of40.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of40.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of40.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) for (var [k = "", v = false] of map) { >k : Symbol(k, Decl(for-of40.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of45.symbols b/tests/baselines/reference/for-of45.symbols index 87c227f5dc9..6f75dd6311d 100644 --- a/tests/baselines/reference/for-of45.symbols +++ b/tests/baselines/reference/for-of45.symbols @@ -5,7 +5,7 @@ var k: string, v: boolean; var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of45.ts, 1, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) for ([k = "", v = false] of map) { >k : Symbol(k, Decl(for-of45.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of50.symbols b/tests/baselines/reference/for-of50.symbols index c01a37bf409..7fb77790ef7 100644 --- a/tests/baselines/reference/for-of50.symbols +++ b/tests/baselines/reference/for-of50.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of50.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of50.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) for (const [k, v] of map) { >k : Symbol(k, Decl(for-of50.ts, 1, 12)) diff --git a/tests/baselines/reference/for-of57.symbols b/tests/baselines/reference/for-of57.symbols index ff061ffcca1..9aadb415e8f 100644 --- a/tests/baselines/reference/for-of57.symbols +++ b/tests/baselines/reference/for-of57.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of57.ts === var iter: Iterable; >iter : Symbol(iter, Decl(for-of57.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) for (let num of iter) { } >num : Symbol(num, Decl(for-of57.ts, 1, 8)) diff --git a/tests/baselines/reference/generatorOverloads4.symbols b/tests/baselines/reference/generatorOverloads4.symbols index 647576d081e..233af97ee59 100644 --- a/tests/baselines/reference/generatorOverloads4.symbols +++ b/tests/baselines/reference/generatorOverloads4.symbols @@ -5,15 +5,15 @@ class C { f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 1, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 2, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) *f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 3, 7)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) } diff --git a/tests/baselines/reference/generatorOverloads5.symbols b/tests/baselines/reference/generatorOverloads5.symbols index e876a2619d2..e3b14d76cd0 100644 --- a/tests/baselines/reference/generatorOverloads5.symbols +++ b/tests/baselines/reference/generatorOverloads5.symbols @@ -5,15 +5,15 @@ module M { function f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 1, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) function f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 2, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) function* f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 3, 16)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) } diff --git a/tests/baselines/reference/generatorTypeCheck1.symbols b/tests/baselines/reference/generatorTypeCheck1.symbols index 728084f01d0..3353182c7db 100644 --- a/tests/baselines/reference/generatorTypeCheck1.symbols +++ b/tests/baselines/reference/generatorTypeCheck1.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck1.ts === function* g1(): Iterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck1.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 4363, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4390, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck10.symbols b/tests/baselines/reference/generatorTypeCheck10.symbols index f00d72007f5..9dc3d726f8d 100644 --- a/tests/baselines/reference/generatorTypeCheck10.symbols +++ b/tests/baselines/reference/generatorTypeCheck10.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck10.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck10.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) return; } diff --git a/tests/baselines/reference/generatorTypeCheck11.symbols b/tests/baselines/reference/generatorTypeCheck11.symbols index 48a1abfbaca..fabd19cd199 100644 --- a/tests/baselines/reference/generatorTypeCheck11.symbols +++ b/tests/baselines/reference/generatorTypeCheck11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck11.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck11.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) return 0; } diff --git a/tests/baselines/reference/generatorTypeCheck12.symbols b/tests/baselines/reference/generatorTypeCheck12.symbols index 745e4831b12..4fe733933bb 100644 --- a/tests/baselines/reference/generatorTypeCheck12.symbols +++ b/tests/baselines/reference/generatorTypeCheck12.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck12.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck12.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) return ""; } diff --git a/tests/baselines/reference/generatorTypeCheck13.symbols b/tests/baselines/reference/generatorTypeCheck13.symbols index c6189a6ef64..8a720da6ee5 100644 --- a/tests/baselines/reference/generatorTypeCheck13.symbols +++ b/tests/baselines/reference/generatorTypeCheck13.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck13.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck13.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) yield 0; return ""; diff --git a/tests/baselines/reference/generatorTypeCheck17.symbols b/tests/baselines/reference/generatorTypeCheck17.symbols index 51d6c40ae37..28c4bb60055 100644 --- a/tests/baselines/reference/generatorTypeCheck17.symbols +++ b/tests/baselines/reference/generatorTypeCheck17.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck17.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck19.symbols b/tests/baselines/reference/generatorTypeCheck19.symbols index 12bf5e5e34e..0c6bbbb462e 100644 --- a/tests/baselines/reference/generatorTypeCheck19.symbols +++ b/tests/baselines/reference/generatorTypeCheck19.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck19.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck2.symbols b/tests/baselines/reference/generatorTypeCheck2.symbols index c03276b6c9b..99d9a0f0505 100644 --- a/tests/baselines/reference/generatorTypeCheck2.symbols +++ b/tests/baselines/reference/generatorTypeCheck2.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck2.ts === function* g1(): Iterable { } >g1 : Symbol(g1, Decl(generatorTypeCheck2.ts, 0, 0)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck26.symbols b/tests/baselines/reference/generatorTypeCheck26.symbols index 399e4ccc497..f2c13cf6199 100644 --- a/tests/baselines/reference/generatorTypeCheck26.symbols +++ b/tests/baselines/reference/generatorTypeCheck26.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck26.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck26.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 0, 33)) yield x => x.length; diff --git a/tests/baselines/reference/generatorTypeCheck27.symbols b/tests/baselines/reference/generatorTypeCheck27.symbols index 3d0a66382c6..e05147aa4b5 100644 --- a/tests/baselines/reference/generatorTypeCheck27.symbols +++ b/tests/baselines/reference/generatorTypeCheck27.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck27.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck27.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) >x : Symbol(x, Decl(generatorTypeCheck27.ts, 0, 33)) yield * function* () { diff --git a/tests/baselines/reference/generatorTypeCheck28.symbols b/tests/baselines/reference/generatorTypeCheck28.symbols index 96ce1e27c63..b157d464292 100644 --- a/tests/baselines/reference/generatorTypeCheck28.symbols +++ b/tests/baselines/reference/generatorTypeCheck28.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck28.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck28.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 0, 33)) yield * { diff --git a/tests/baselines/reference/generatorTypeCheck29.symbols b/tests/baselines/reference/generatorTypeCheck29.symbols index b01b97eb763..54a5cc0fdb6 100644 --- a/tests/baselines/reference/generatorTypeCheck29.symbols +++ b/tests/baselines/reference/generatorTypeCheck29.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck29.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck29.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 4363, 1)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4390, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >x : Symbol(x, Decl(generatorTypeCheck29.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck3.symbols b/tests/baselines/reference/generatorTypeCheck3.symbols index 79a3164e2d2..5fdef53c6f3 100644 --- a/tests/baselines/reference/generatorTypeCheck3.symbols +++ b/tests/baselines/reference/generatorTypeCheck3.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck3.ts === function* g1(): IterableIterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck3.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4373, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4400, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck30.symbols b/tests/baselines/reference/generatorTypeCheck30.symbols index e337277aa43..d107c4bde19 100644 --- a/tests/baselines/reference/generatorTypeCheck30.symbols +++ b/tests/baselines/reference/generatorTypeCheck30.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck30.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck30.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 4363, 1)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4390, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >x : Symbol(x, Decl(generatorTypeCheck30.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck45.symbols b/tests/baselines/reference/generatorTypeCheck45.symbols index 9cf40641ad6..bb24ffb1eb6 100644 --- a/tests/baselines/reference/generatorTypeCheck45.symbols +++ b/tests/baselines/reference/generatorTypeCheck45.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck45.ts, 0, 32)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 4363, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4390, 1)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck45.ts, 0, 23)) diff --git a/tests/baselines/reference/generatorTypeCheck46.symbols b/tests/baselines/reference/generatorTypeCheck46.symbols index 8b3bf966681..a6dd01be70f 100644 --- a/tests/baselines/reference/generatorTypeCheck46.symbols +++ b/tests/baselines/reference/generatorTypeCheck46.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterable<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck46.ts, 0, 32)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck46.ts, 0, 23)) diff --git a/tests/baselines/reference/iterableArrayPattern30.symbols b/tests/baselines/reference/iterableArrayPattern30.symbols index 523d81cde2d..5a991f0d5b3 100644 --- a/tests/baselines/reference/iterableArrayPattern30.symbols +++ b/tests/baselines/reference/iterableArrayPattern30.symbols @@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]]) >v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11)) >k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18)) >v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21)) ->Map : Symbol(Map, Decl(lib.d.ts, 4608, 1), Decl(lib.d.ts, 4631, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4635, 1), Decl(lib.d.ts, 4658, 11)) diff --git a/tests/baselines/reference/iterableContextualTyping1.symbols b/tests/baselines/reference/iterableContextualTyping1.symbols index 52f5f2d0b17..f23d571d072 100644 --- a/tests/baselines/reference/iterableContextualTyping1.symbols +++ b/tests/baselines/reference/iterableContextualTyping1.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === var iter: Iterable<(x: string) => number> = [s => s.length]; >iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) >s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) diff --git a/tests/baselines/reference/iteratorSpreadInArray11.symbols b/tests/baselines/reference/iteratorSpreadInArray11.symbols index c18c9095f50..a46d22a481a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray11.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts === var iter: Iterable; >iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) var array = [...iter]; >array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3)) diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index b12d564d880..3fc23ce5253 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -22,13 +22,13 @@ interface T3 { function f1(): Promise { >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) return Promise.resolve({ __t1: "foo_t1" }); ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5109, 39), Decl(lib.d.ts, 5116, 54)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 5041, 1), Decl(lib.d.ts, 5127, 11)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5109, 39), Decl(lib.d.ts, 5116, 54)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5136, 39), Decl(lib.d.ts, 5143, 54)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5068, 1), Decl(lib.d.ts, 5154, 11)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5136, 39), Decl(lib.d.ts, 5143, 54)) >__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) } @@ -47,12 +47,12 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) ->f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 5046, 22), Decl(lib.d.ts, 5053, 158)) ->f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 5046, 22), Decl(lib.d.ts, 5053, 158)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 5073, 22), Decl(lib.d.ts, 5080, 158)) +>f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 5073, 22), Decl(lib.d.ts, 5080, 158)) >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) .then(f2, (e: Error) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, 5046, 22), Decl(lib.d.ts, 5053, 158)) +>then : Symbol(Promise.then, Decl(lib.d.ts, 5073, 22), Decl(lib.d.ts, 5080, 158)) >f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) >Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11)) @@ -62,7 +62,7 @@ var x3 = f1() }) .then((x: T2) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, 5046, 22), Decl(lib.d.ts, 5053, 158)) +>then : Symbol(Promise.then, Decl(lib.d.ts, 5073, 22), Decl(lib.d.ts, 5080, 158)) >x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) diff --git a/tests/baselines/reference/stringIncludes.symbols b/tests/baselines/reference/stringIncludes.symbols index 0ca53dbb837..1348b62e566 100644 --- a/tests/baselines/reference/stringIncludes.symbols +++ b/tests/baselines/reference/stringIncludes.symbols @@ -5,11 +5,11 @@ var includes: boolean; includes = "abcde".includes("cd"); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4222, 37)) ->includes : Symbol(String.includes, Decl(lib.d.ts, 4222, 37)) +>"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4249, 37)) +>includes : Symbol(String.includes, Decl(lib.d.ts, 4249, 37)) includes = "abcde".includes("cd", 2); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4222, 37)) ->includes : Symbol(String.includes, Decl(lib.d.ts, 4222, 37)) +>"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4249, 37)) +>includes : Symbol(String.includes, Decl(lib.d.ts, 4249, 37)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols index 42a865e4e28..9d8b6024e0c 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperatorES6.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperatorES6.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4209, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4236, 1)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols index 28cb344da6e..557175473da 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols @@ -3,7 +3,7 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType1.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType1.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols index 2287b1db082..f25ca2bba6b 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols @@ -3,14 +3,14 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType2.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType2.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) function inner>() { >inner : Symbol(inner, Decl(typeArgumentInferenceApparentType2.ts, 0, 46)) >U : Symbol(U, Decl(typeArgumentInferenceApparentType2.ts, 1, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 4369, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4396, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) var u: U; diff --git a/tests/baselines/reference/typedArrays.symbols b/tests/baselines/reference/typedArrays.symbols index dcba2e51f48..41fbab91e3c 100644 --- a/tests/baselines/reference/typedArrays.symbols +++ b/tests/baselines/reference/typedArrays.symbols @@ -8,39 +8,39 @@ function CreateTypedArrayTypes() { typedArrays[0] = Int8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) typedArrays[1] = Uint8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) typedArrays[2] = Int16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) typedArrays[3] = Uint16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) typedArrays[4] = Int32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) typedArrays[5] = Uint32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) typedArrays[6] = Float32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) typedArrays[7] = Float64Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) typedArrays[8] = Uint8ClampedArray; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) @@ -55,47 +55,47 @@ function CreateTypedArrayInstancesFromLength(obj: number) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) return typedArrays; @@ -111,47 +111,47 @@ function CreateTypedArrayInstancesFromArray(obj: number[]) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) return typedArrays; @@ -167,65 +167,65 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) return typedArrays; @@ -242,65 +242,65 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) return typedArrays; @@ -333,55 +333,55 @@ function CreateTypedArraysOf2() { typedArrays[0] = Int8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 1635, 30)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) >of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 1635, 30)) typedArrays[1] = Uint8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 1909, 30)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) >of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 1909, 30)) typedArrays[2] = Int16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 2456, 30)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) >of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 2456, 30)) typedArrays[3] = Uint16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 2730, 30)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) >of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 2730, 30)) typedArrays[4] = Int32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3003, 30)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) >of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3003, 30)) typedArrays[5] = Uint32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 3276, 30)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) >of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 3276, 30)) typedArrays[6] = Float32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 3549, 30)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) >of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 3549, 30)) typedArrays[7] = Float64Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 3823, 30)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) >of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 3823, 30)) typedArrays[8] = Uint8ClampedArray.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) >Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2183, 30)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) >of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2183, 30)) return typedArrays; @@ -401,73 +401,73 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n typedArrays[0] = Int8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[1] = Uint8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[2] = Int16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[3] = Uint16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[4] = Int32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[5] = Uint32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[6] = Float32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[7] = Float64Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) @@ -489,81 +489,81 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4704, 1)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4727, 48)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1379, 42), Decl(lib.d.ts, 1652, 11), Decl(lib.d.ts, 4731, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1641, 38), Decl(lib.d.ts, 4754, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4736, 1)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4759, 49)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1652, 44), Decl(lib.d.ts, 1926, 11), Decl(lib.d.ts, 4763, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1915, 39), Decl(lib.d.ts, 4786, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4804, 1)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4831, 49)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2199, 60), Decl(lib.d.ts, 2473, 11), Decl(lib.d.ts, 4831, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2462, 39), Decl(lib.d.ts, 4858, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4840, 1)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4863, 50)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2473, 46), Decl(lib.d.ts, 2747, 11), Decl(lib.d.ts, 4867, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2736, 40), Decl(lib.d.ts, 4890, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4872, 1)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4895, 49)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2747, 48), Decl(lib.d.ts, 3019, 11), Decl(lib.d.ts, 4899, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3009, 39), Decl(lib.d.ts, 4922, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4904, 1)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4927, 50)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3019, 46), Decl(lib.d.ts, 3292, 11), Decl(lib.d.ts, 4931, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3282, 40), Decl(lib.d.ts, 4954, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4936, 1)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4959, 51)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3292, 48), Decl(lib.d.ts, 3566, 11), Decl(lib.d.ts, 4963, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3555, 41), Decl(lib.d.ts, 4986, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4968, 1)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 4991, 51)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3566, 50), Decl(lib.d.ts, 3839, 11), Decl(lib.d.ts, 4995, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3829, 41), Decl(lib.d.ts, 5018, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4768, 1)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4794, 56)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1926, 46), Decl(lib.d.ts, 2199, 11), Decl(lib.d.ts, 4795, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2189, 46), Decl(lib.d.ts, 4821, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) From 22eef28cbdfc9a39851d456b619869ee2a908a3a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 14:17:23 -0700 Subject: [PATCH 57/75] forEach -> for-of, and other changes. --- .../importDefinitelyTypedTests.ts | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index fa935c2fa31..9e3f3183bc8 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -17,10 +17,12 @@ const tscPath = path.join(tscRoot, "built", "instrumented", "tsc.js"); const rwcTestPath = path.join(tscRoot, "tests", "cases", "rwc", "dt"); const definitelyTypedRoot = process.argv[2]; -function fileExtensionIs(path: string, extension: string): boolean { +importDefinitelyTypedTests(definitelyTypedRoot); + +function filePathEndsWith(path: string, endingString: string): boolean { const pathLen = path.length; - const extLen = extension.length; - return pathLen > extLen && path.substr(pathLen - extLen, extLen).toLocaleLowerCase() === extension.toLocaleLowerCase(); + const extLen = endingString.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen).toLocaleLowerCase() === endingString.toLocaleLowerCase(); } function copyFileSync(source: string, destination: string) { @@ -94,7 +96,7 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void { .filter(i => i.indexOf("sipml") >=0 ) .filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory()) .forEach(d => { - let directoryPath = path.join(definitelyTypedRoot, d); + const directoryPath = path.join(definitelyTypedRoot, d); fs.readdir(directoryPath, function (err, files) { if (err) { throw err; @@ -104,35 +106,37 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void { let testFiles: string[] = []; let paramFile: string; - files - .map(f => path.join(directoryPath, f)) - .forEach(f => { - if (fileExtensionIs(f, ".ts")) tsFiles.push(f); - else if (fileExtensionIs(f, ".tscparams")) paramFile = f; + for (const filePath of files.map(f => path.join(directoryPath, f))) { + if (filePathEndsWith(filePath, ".ts")) { + tsFiles.push(filePath); - if (fileExtensionIs(f, "-tests.ts")) testFiles.push(f); - }); + if (filePathEndsWith(filePath, "-tests.ts")) { + testFiles.push(filePath); + } + } + else if (filePathEndsWith(filePath, ".tscparams")) { + paramFile = filePath; + } + } if (testFiles.length === 0) { // no test files but multiple d.ts's, e.g. winjs let regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); - if (tsFiles.length > 1 && tsFiles.every(t => fileExtensionIs(t, ".d.ts") && regexp.test(t))) { - tsFiles.forEach(filename => { - importDefinitelyTypedTest(path.basename(filename, ".d.ts"), [filename], paramFile); - }); + if (tsFiles.length > 1 && tsFiles.every(t => filePathEndsWith(t, ".d.ts") && regexp.test(t))) { + for (const fileName of tsFiles) { + importDefinitelyTypedTest(path.basename(fileName, ".d.ts"), [fileName], paramFile); + } } else { importDefinitelyTypedTest(d, tsFiles, paramFile); } } else { - testFiles.forEach(filename => { - importDefinitelyTypedTest(path.basename(filename, "-tests.ts"), [filename], paramFile); - }); + for (const fileName of tsFiles) { + importDefinitelyTypedTest(path.basename(fileName, "-tests.ts"), [fileName], paramFile); + } } }); }) }); -} - -importDefinitelyTypedTests(definitelyTypedRoot); \ No newline at end of file +} \ No newline at end of file From 23af2a71639cd642422f4d2309a5ed7853675caa Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 16:37:03 -0700 Subject: [PATCH 58/75] Improved command line interaction for 'importDefinitelyTypedTests' script. --- .../importDefinitelyTypedTests.ts | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index 9e3f3183bc8..5a9eb885b38 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -2,22 +2,37 @@ import * as fs from "fs"; import * as path from "path"; import * as child_process from "child_process"; + interface Map { [key: string]: T; } -declare const __dirname: string; -declare const process: { +declare var process: { argv: string[]; - env: Map + env: Map; + exit(exitCode?: number): void; } -const tscRoot = path.join(__dirname, "..\\"); -const tscPath = path.join(tscRoot, "built", "instrumented", "tsc.js"); -const rwcTestPath = path.join(tscRoot, "tests", "cases", "rwc", "dt"); -const definitelyTypedRoot = process.argv[2]; +main(); +function main() { + const [, progName, tscRoot, definitelyTypedRoot] = process.argv; + if (process.argv.length !== 4) { + if (process.argv.length < 2) { + throw "Expected at least 2 argv elements." + } + console.log("Usage:") + console.log(` node ${path.relative(__dirname, progName)} [TypeScript Repo Root] [DefinitelyTyped Repo Root]`); + return; + } -importDefinitelyTypedTests(definitelyTypedRoot); + const tscPath = path.resolve(tscRoot, "built", "local", "tsc.js"); + const rwcTestPath = path.resolve(tscRoot, "tests", "cases", "rwc", "dt"); + const resolvedDefinitelyTypedRoot = path.resolve(definitelyTypedRoot); + + console.log(`Resolved TypeScript Repo Root: '${tscRoot}'.`); + console.log(`Resolved DefinitelyTyped Repo Root: '${definitelyTypedRoot}'.`); + importDefinitelyTypedTests(tscPath, rwcTestPath, resolvedDefinitelyTypedRoot); +} function filePathEndsWith(path: string, endingString: string): boolean { const pathLen = path.length; @@ -27,10 +42,10 @@ function filePathEndsWith(path: string, endingString: string): boolean { function copyFileSync(source: string, destination: string) { let text = fs.readFileSync(source); - fs.writeFileSync(destination, text); + fs.writeFileSync(destination, text, {}); } -function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], responseFile: string ) { +function importDefinitelyTypedTest(tscPath: string, rwcTestPath: string, testCaseName: string, testFiles: string[], responseFile: string ) { let cmd = "node " + tscPath + " --module commonjs " + testFiles.join(" "); if (responseFile) { cmd += " @" + responseFile; @@ -85,7 +100,7 @@ function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], re }); } -function importDefinitelyTypedTests(definitelyTypedRoot: string): void { +function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, definitelyTypedRoot: string): void { fs.readdir(definitelyTypedRoot, (err, subDirectories) => { if (err) { throw err; @@ -124,16 +139,16 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void { let regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); if (tsFiles.length > 1 && tsFiles.every(t => filePathEndsWith(t, ".d.ts") && regexp.test(t))) { for (const fileName of tsFiles) { - importDefinitelyTypedTest(path.basename(fileName, ".d.ts"), [fileName], paramFile); + importDefinitelyTypedTest(tscPath, rwcTestPath, path.basename(fileName, ".d.ts"), [fileName], paramFile); } } else { - importDefinitelyTypedTest(d, tsFiles, paramFile); + importDefinitelyTypedTest(tscPath, rwcTestPath, d, tsFiles, paramFile); } } else { for (const fileName of tsFiles) { - importDefinitelyTypedTest(path.basename(fileName, "-tests.ts"), [fileName], paramFile); + importDefinitelyTypedTest(tscPath, rwcTestPath, path.basename(fileName, "-tests.ts"), [fileName], paramFile); } } }); From bf989aa56572663742626477f1bb463af07a74f6 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 17:26:10 -0700 Subject: [PATCH 59/75] Final touches on the script. --- .../importDefinitelyTypedTests.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index 5a9eb885b38..1e673c34d32 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -26,11 +26,12 @@ function main() { } const tscPath = path.resolve(tscRoot, "built", "local", "tsc.js"); - const rwcTestPath = path.resolve(tscRoot, "tests", "cases", "rwc", "dt"); + const rwcTestPath = path.resolve(tscRoot, "internal", "cases", "rwc"); const resolvedDefinitelyTypedRoot = path.resolve(definitelyTypedRoot); - console.log(`Resolved TypeScript Repo Root: '${tscRoot}'.`); - console.log(`Resolved DefinitelyTyped Repo Root: '${definitelyTypedRoot}'.`); + console.log(`Resolved TypeScript Compiler Path: '${tscPath}'.`); + console.log(`Resolved TypeScript RWC Path: '${rwcTestPath}'.`); + console.log(`Resolved DefinitelyTyped Repo Root: '${resolvedDefinitelyTypedRoot}'.`); importDefinitelyTypedTests(tscPath, rwcTestPath, resolvedDefinitelyTypedRoot); } @@ -42,7 +43,7 @@ function filePathEndsWith(path: string, endingString: string): boolean { function copyFileSync(source: string, destination: string) { let text = fs.readFileSync(source); - fs.writeFileSync(destination, text, {}); + fs.writeFileSync(destination, text); } function importDefinitelyTypedTest(tscPath: string, rwcTestPath: string, testCaseName: string, testFiles: string[], responseFile: string ) { @@ -108,7 +109,7 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini subDirectories .filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0) - .filter(i => i.indexOf("sipml") >=0 ) + // .filter(i => i.indexOf("sipml") >= 0 ) // Uncomment when you want to test :) .filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory()) .forEach(d => { const directoryPath = path.join(definitelyTypedRoot, d); From 925f0843d90956ea27fd3775bf3d1935ea5cf6d4 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 17:55:07 -0700 Subject: [PATCH 60/75] Add a jake task, .gitignore entry, and add tsd as a dev dependency. --- .gitignore | 3 ++- Jakefile.js | 21 +++++++++++++++++++++ package.json | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 58a45545939..9a513646e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ tests/services/browser/typescriptServices.js scripts/configureNightly.js scripts/processDiagnosticMessages.d.ts scripts/processDiagnosticMessages.js -scripts/importDefinitelyTypedTests.js +scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js src/harness/*.js rwc-report.html *.swp @@ -45,6 +45,7 @@ scripts/run.bat scripts/word2md.js scripts/ior.js scripts/*.js.map +scripts/typings/ coverage/ internal/ **/.DS_Store diff --git a/Jakefile.js b/Jakefile.js index 77d81071e66..cdb03d7f778 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -386,6 +386,27 @@ task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "r exec(cmd); }); +var scriptsTsdJson = path.join(scriptsDirectory, "tsd.json"); +file(scriptsTsdJson); + +task("tsd-scripts", [scriptsTsdJson], function () { + var cmd = "tsd --config " + scriptsTsdJson + " install"; + console.log(cmd) + exec(cmd); +}, { async: true }) + +var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests"); +var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js"); +var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts"); + +file(importDefinitelyTypedTestsJs); +file(importDefinitelyTypedTestsTs, ["tsd-scripts", importDefinitelyTypedTestsJs]) +task("importDefinitelyTyped", importDefinitelyTypedTestsTs, function () { + var cmd = "node " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped"; + console.log(cmd); + exec(cmd); +}, { async: true }) + // Local target to build the compiler and services var tscFile = path.join(builtLocalDirectory, compilerFilename); compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false); diff --git a/package.json b/package.json index b743b04838d..ba8edd188e4 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "browserify": "latest", "istanbul": "latest", "mocha-fivemat-progress-reporter": "latest", - "tslint": "latest" + "tslint": "latest", + "tsd": "latest" }, "scripts": { "pretest": "jake tests", From 37ee17d40d5d04865963fb82ccfb809523d9e1b8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 17:56:39 -0700 Subject: [PATCH 61/75] es3 -> es5. --- scripts/importDefinitelyTypedTests/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/importDefinitelyTypedTests/tsconfig.json b/scripts/importDefinitelyTypedTests/tsconfig.json index 3bf148ffa5c..dede4572531 100644 --- a/scripts/importDefinitelyTypedTests/tsconfig.json +++ b/scripts/importDefinitelyTypedTests/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es3", + "target": "ES5", "noImplicitAny": true, "outDir": "./", "rootDir": ".", From 55218d64a58a9964229daa0a38bdfb0a6be717e5 Mon Sep 17 00:00:00 2001 From: Punya Biswal Date: Fri, 18 Sep 2015 08:42:42 -0400 Subject: [PATCH 62/75] Fix capitalization of minimumintegerDigits --- lib/lib.d.ts | 4 ++-- lib/lib.dom.d.ts | 6 +++--- lib/lib.es6.d.ts | 4 ++-- lib/lib.webworker.d.ts | 6 +++--- src/lib/intl.d.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/lib.d.ts b/lib/lib.d.ts index d25e29bddb4..a65fc96e43f 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -3881,7 +3881,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -3894,7 +3894,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 76e5f1b20a1..ac031db886b 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -57,7 +57,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -70,7 +70,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -13192,4 +13192,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 507f0da5004..abced59c41a 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -5169,7 +5169,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -5182,7 +5182,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 56e08ff6efc..b560065ef39 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -57,7 +57,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -70,7 +70,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -1199,4 +1199,4 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts index b5291306b87..53894587259 100644 --- a/src/lib/intl.d.ts +++ b/src/lib/intl.d.ts @@ -41,7 +41,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -54,7 +54,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; From 3fa6b6de3aa9c656b7f9cd6edae933aa90e9a26a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Sep 2015 10:59:19 -0700 Subject: [PATCH 63/75] Accepted baselines, issue not apparent in compiler tests. --- ...ssExpressionMethodDeclaration01.errors.txt | 67 +++++++++ ...TypedClassExpressionMethodDeclaration01.js | 88 ++++++++++++ ...ssExpressionMethodDeclaration02.errors.txt | 71 ++++++++++ ...TypedClassExpressionMethodDeclaration02.js | 92 ++++++++++++ ...lyTypedObjectLiteralMethodDeclaration01.js | 79 +++++++++++ ...edObjectLiteralMethodDeclaration01.symbols | 110 +++++++++++++++ ...ypedObjectLiteralMethodDeclaration01.types | 132 ++++++++++++++++++ 7 files changed, 639 insertions(+) create mode 100644 tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.errors.txt create mode 100644 tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js create mode 100644 tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.errors.txt create mode 100644 tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.js create mode 100644 tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.js create mode 100644 tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols create mode 100644 tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.types diff --git a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.errors.txt b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.errors.txt new file mode 100644 index 00000000000..dab85baf2cf --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.errors.txt @@ -0,0 +1,67 @@ +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(17,24): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(20,24): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(28,27): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(31,27): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(39,36): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts(42,36): error TS7006: Parameter 'arg' implicitly has an 'any' type. + + +==== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration01.ts (6 errors) ==== + + interface A { + numProp: number; + } + + interface B { + strProp: string; + } + + interface Foo { + method1(arg: A): void; + method2(arg: B): void; + } + + function getFoo1(): Foo { + return class { + static method1(arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + static method2(arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } + + function getFoo2(): Foo { + return class { + static method1 = (arg) => { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + static method2 = (arg) => { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } + + function getFoo3(): Foo { + return class { + static method1 = function (arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + static method2 = function (arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js new file mode 100644 index 00000000000..edbe8c4d338 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js @@ -0,0 +1,88 @@ +//// [contextuallyTypedClassExpressionMethodDeclaration01.ts] + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return class { + static method1(arg) { + arg.numProp = 10; + } + static method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return class { + static method1 = (arg) => { + arg.numProp = 10; + } + static method2 = (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return class { + static method1 = function (arg) { + arg.numProp = 10; + } + static method2 = function (arg) { + arg.strProp = "hello"; + } + } +} + +//// [contextuallyTypedClassExpressionMethodDeclaration01.js] +function getFoo1() { + return (function () { + function class_1() { + } + class_1.method1 = function (arg) { + arg.numProp = 10; + }; + class_1.method2 = function (arg) { + arg.strProp = "hello"; + }; + return class_1; + })(); +} +function getFoo2() { + return (function () { + function class_2() { + } + class_2.method1 = function (arg) { + arg.numProp = 10; + }; + class_2.method2 = function (arg) { + arg.strProp = "hello"; + }; + return class_2; + })(); +} +function getFoo3() { + return (function () { + function class_3() { + } + class_3.method1 = function (arg) { + arg.numProp = 10; + }; + class_3.method2 = function (arg) { + arg.strProp = "hello"; + }; + return class_3; + })(); +} diff --git a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.errors.txt b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.errors.txt new file mode 100644 index 00000000000..ae6dfee4866 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.errors.txt @@ -0,0 +1,71 @@ +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(21,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(24,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(32,20): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(35,20): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(43,29): error TS7006: Parameter 'arg' implicitly has an 'any' type. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts(46,29): error TS7006: Parameter 'arg' implicitly has an 'any' type. + + +==== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedClassExpressionMethodDeclaration02.ts (6 errors) ==== + + interface A { + numProp: number; + } + + interface B { + strProp: string; + } + + interface Foo { + new (): Bar; + } + + interface Bar { + method1(arg: A): void; + method2(arg: B): void; + } + + function getFoo1(): Foo { + return class { + method1(arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + method2(arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } + + function getFoo2(): Foo { + return class { + method1 = (arg) => { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + method2 = (arg) => { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } + + function getFoo3(): Foo { + return class { + method1 = function (arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.numProp = 10; + } + method2 = function (arg) { + ~~~ +!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. + arg.strProp = "hello"; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.js b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.js new file mode 100644 index 00000000000..43e9134689f --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration02.js @@ -0,0 +1,92 @@ +//// [contextuallyTypedClassExpressionMethodDeclaration02.ts] + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + new (): Bar; +} + +interface Bar { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return class { + method1(arg) { + arg.numProp = 10; + } + method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return class { + method1 = (arg) => { + arg.numProp = 10; + } + method2 = (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return class { + method1 = function (arg) { + arg.numProp = 10; + } + method2 = function (arg) { + arg.strProp = "hello"; + } + } +} + +//// [contextuallyTypedClassExpressionMethodDeclaration02.js] +function getFoo1() { + return (function () { + function class_1() { + } + class_1.prototype.method1 = function (arg) { + arg.numProp = 10; + }; + class_1.prototype.method2 = function (arg) { + arg.strProp = "hello"; + }; + return class_1; + })(); +} +function getFoo2() { + return (function () { + function class_2() { + this.method1 = function (arg) { + arg.numProp = 10; + }; + this.method2 = function (arg) { + arg.strProp = "hello"; + }; + } + return class_2; + })(); +} +function getFoo3() { + return (function () { + function class_3() { + this.method1 = function (arg) { + arg.numProp = 10; + }; + this.method2 = function (arg) { + arg.strProp = "hello"; + }; + } + return class_3; + })(); +} diff --git a/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.js b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.js new file mode 100644 index 00000000000..373854114d5 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.js @@ -0,0 +1,79 @@ +//// [contextuallyTypedObjectLiteralMethodDeclaration01.ts] + +interface A { + numProp: number; +} + +interface B { + strProp: string; +} + +interface Foo { + method1(arg: A): void; + method2(arg: B): void; +} + +function getFoo1(): Foo { + return { + method1(arg) { + arg.numProp = 10; + }, + method2(arg) { + arg.strProp = "hello"; + } + } +} + +function getFoo2(): Foo { + return { + method1: (arg) => { + arg.numProp = 10; + }, + method2: (arg) => { + arg.strProp = "hello"; + } + } +} + +function getFoo3(): Foo { + return { + method1: function (arg) { + arg.numProp = 10; + }, + method2: function (arg) { + arg.strProp = "hello"; + } + } +} + +//// [contextuallyTypedObjectLiteralMethodDeclaration01.js] +function getFoo1() { + return { + method1: function (arg) { + arg.numProp = 10; + }, + method2: function (arg) { + arg.strProp = "hello"; + } + }; +} +function getFoo2() { + return { + method1: function (arg) { + arg.numProp = 10; + }, + method2: function (arg) { + arg.strProp = "hello"; + } + }; +} +function getFoo3() { + return { + method1: function (arg) { + arg.numProp = 10; + }, + method2: function (arg) { + arg.strProp = "hello"; + } + }; +} diff --git a/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols new file mode 100644 index 00000000000..3c26110157a --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.symbols @@ -0,0 +1,110 @@ +=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts === + +interface A { +>A : Symbol(A, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 0, 0)) + + numProp: number; +>numProp : Symbol(numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) +} + +interface B { +>B : Symbol(B, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 3, 1)) + + strProp: string; +>strProp : Symbol(strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) +} + +interface Foo { +>Foo : Symbol(Foo, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 7, 1)) + + method1(arg: A): void; +>method1 : Symbol(method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 9, 15)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 10, 12)) +>A : Symbol(A, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 0, 0)) + + method2(arg: B): void; +>method2 : Symbol(method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 10, 26)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 11, 12)) +>B : Symbol(B, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 3, 1)) +} + +function getFoo1(): Foo { +>getFoo1 : Symbol(getFoo1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 12, 1)) +>Foo : Symbol(Foo, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 7, 1)) + + return { + method1(arg) { +>method1 : Symbol(method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 15, 12)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 16, 16)) + + arg.numProp = 10; +>arg.numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 16, 16)) +>numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) + + }, + method2(arg) { +>method2 : Symbol(method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 18, 10)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 19, 16)) + + arg.strProp = "hello"; +>arg.strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 19, 16)) +>strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) + } + } +} + +function getFoo2(): Foo { +>getFoo2 : Symbol(getFoo2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 23, 1)) +>Foo : Symbol(Foo, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 7, 1)) + + return { + method1: (arg) => { +>method1 : Symbol(method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 26, 12)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 27, 18)) + + arg.numProp = 10; +>arg.numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 27, 18)) +>numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) + + }, + method2: (arg) => { +>method2 : Symbol(method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 29, 10)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 30, 18)) + + arg.strProp = "hello"; +>arg.strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 30, 18)) +>strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) + } + } +} + +function getFoo3(): Foo { +>getFoo3 : Symbol(getFoo3, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 34, 1)) +>Foo : Symbol(Foo, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 7, 1)) + + return { + method1: function (arg) { +>method1 : Symbol(method1, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 37, 12)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 38, 27)) + + arg.numProp = 10; +>arg.numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 38, 27)) +>numProp : Symbol(A.numProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 1, 13)) + + }, + method2: function (arg) { +>method2 : Symbol(method2, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 40, 10)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 41, 27)) + + arg.strProp = "hello"; +>arg.strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) +>arg : Symbol(arg, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 41, 27)) +>strProp : Symbol(B.strProp, Decl(contextuallyTypedObjectLiteralMethodDeclaration01.ts, 5, 14)) + } + } +} diff --git a/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.types b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.types new file mode 100644 index 00000000000..dcb25792fe0 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedObjectLiteralMethodDeclaration01.types @@ -0,0 +1,132 @@ +=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedObjectLiteralMethodDeclaration01.ts === + +interface A { +>A : A + + numProp: number; +>numProp : number +} + +interface B { +>B : B + + strProp: string; +>strProp : string +} + +interface Foo { +>Foo : Foo + + method1(arg: A): void; +>method1 : (arg: A) => void +>arg : A +>A : A + + method2(arg: B): void; +>method2 : (arg: B) => void +>arg : B +>B : B +} + +function getFoo1(): Foo { +>getFoo1 : () => Foo +>Foo : Foo + + return { +>{ method1(arg) { arg.numProp = 10; }, method2(arg) { arg.strProp = "hello"; } } : { method1(arg: A): void; method2(arg: B): void; } + + method1(arg) { +>method1 : (arg: A) => void +>arg : A + + arg.numProp = 10; +>arg.numProp = 10 : number +>arg.numProp : number +>arg : A +>numProp : number +>10 : number + + }, + method2(arg) { +>method2 : (arg: B) => void +>arg : B + + arg.strProp = "hello"; +>arg.strProp = "hello" : string +>arg.strProp : string +>arg : B +>strProp : string +>"hello" : string + } + } +} + +function getFoo2(): Foo { +>getFoo2 : () => Foo +>Foo : Foo + + return { +>{ method1: (arg) => { arg.numProp = 10; }, method2: (arg) => { arg.strProp = "hello"; } } : { method1: (arg: A) => void; method2: (arg: B) => void; } + + method1: (arg) => { +>method1 : (arg: A) => void +>(arg) => { arg.numProp = 10; } : (arg: A) => void +>arg : A + + arg.numProp = 10; +>arg.numProp = 10 : number +>arg.numProp : number +>arg : A +>numProp : number +>10 : number + + }, + method2: (arg) => { +>method2 : (arg: B) => void +>(arg) => { arg.strProp = "hello"; } : (arg: B) => void +>arg : B + + arg.strProp = "hello"; +>arg.strProp = "hello" : string +>arg.strProp : string +>arg : B +>strProp : string +>"hello" : string + } + } +} + +function getFoo3(): Foo { +>getFoo3 : () => Foo +>Foo : Foo + + return { +>{ method1: function (arg) { arg.numProp = 10; }, method2: function (arg) { arg.strProp = "hello"; } } : { method1: (arg: A) => void; method2: (arg: B) => void; } + + method1: function (arg) { +>method1 : (arg: A) => void +>function (arg) { arg.numProp = 10; } : (arg: A) => void +>arg : A + + arg.numProp = 10; +>arg.numProp = 10 : number +>arg.numProp : number +>arg : A +>numProp : number +>10 : number + + }, + method2: function (arg) { +>method2 : (arg: B) => void +>function (arg) { arg.strProp = "hello"; } : (arg: B) => void +>arg : B + + arg.strProp = "hello"; +>arg.strProp = "hello" : string +>arg.strProp : string +>arg : B +>strProp : string +>"hello" : string + } + } +} From 76da69c6c6d6b72f0a5f3949434a1474a593c781 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 18 Sep 2015 10:56:40 -0700 Subject: [PATCH 64/75] Added failing fourslash test. --- ...edObjectLiteralMethodDeclarationParam01.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/cases/fourslash/contextuallyTypedObjectLiteralMethodDeclarationParam01.ts diff --git a/tests/cases/fourslash/contextuallyTypedObjectLiteralMethodDeclarationParam01.ts b/tests/cases/fourslash/contextuallyTypedObjectLiteralMethodDeclarationParam01.ts new file mode 100644 index 00000000000..6aabbbdbdce --- /dev/null +++ b/tests/cases/fourslash/contextuallyTypedObjectLiteralMethodDeclarationParam01.ts @@ -0,0 +1,32 @@ +/// + +// @noImplicitAny: true + +////interface A { +//// numProp: number; +////} +//// +////interface B { +//// strProp: string; +////} +//// +////interface Foo { +//// method1(arg: A): void; +//// method2(arg: B): void; +////} +//// +////function getFoo1(): Foo { +//// return { +//// method1(/*param1*/arg) { +//// arg.numProp = 10; +//// }, +//// method2(/*param2*/arg) { +//// arg.strProp = "hello"; +//// } +//// } +////} + +goTo.marker("param1"); +verify.quickInfoIs("(parameter) arg: A") +goTo.marker("param2"); +verify.quickInfoIs("(parameter) arg: B") From 2aa97bd1b94bcd1b655bbf3d063804961cb5c1d9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 18 Sep 2015 10:58:17 -0700 Subject: [PATCH 65/75] Use custom type guard. --- src/compiler/checker.ts | 8 ++++---- src/compiler/utilities.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 80a04129eed..db6f2377a36 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6907,7 +6907,7 @@ namespace ts { } } - function isFunctionExpressionOrArrowFunction(node: Node): boolean { + function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression { return node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction; } @@ -6926,8 +6926,8 @@ namespace ts { function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); let type = isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + ? getContextualTypeForObjectLiteralMethod(node) + : getContextualType(node); if (!type) { return undefined; } @@ -13656,7 +13656,7 @@ namespace ts { forEach(node.decorators, checkFunctionAndClassExpressionBodies); forEach((node).parameters, checkFunctionAndClassExpressionBodies); if (isObjectLiteralMethod(node)) { - checkFunctionExpressionOrObjectLiteralMethodBody(node); + checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; case SyntaxKind.Constructor: diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ed8b516b7f3..a1f2b53ecff 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -660,7 +660,7 @@ namespace ts { return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent); } - export function isObjectLiteralMethod(node: Node) { + export function isObjectLiteralMethod(node: Node): node is MethodDeclaration { return node && node.kind === SyntaxKind.MethodDeclaration && node.parent.kind === SyntaxKind.ObjectLiteralExpression; } From 254af55204ebc18a8ea3576085350615c9adb0c8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 18 Sep 2015 12:19:29 -0700 Subject: [PATCH 66/75] Added missing predicate for contextual types of parameters. --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index db6f2377a36..2aee597092d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6574,8 +6574,8 @@ namespace ts { // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - let func = parameter.parent; + let func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { let contextualSignature = getContextualSignature(func); if (contextualSignature) { From 5a2a7021fa8d9a72881c88c3b8128ab24a67a049 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 18 Sep 2015 13:13:26 -0700 Subject: [PATCH 67/75] Fix jake task, style/const in script. --- Jakefile.js | 26 ++++++++++++------- .../importDefinitelyTypedTests.ts | 7 +++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index cdb03d7f778..72844e01cf0 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -206,6 +206,9 @@ function concatenateFiles(destinationFile, sourceFiles) { var useDebugMode = true; var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node"); var compilerFilename = "tsc.js"; +var LKGCompiler = path.join(LKGDirectory, compilerFilename); +var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); + /* Compiles a file from a list of sources * @param outFile: the target file name * @param sources: an array of the names of the source files @@ -220,7 +223,7 @@ var compilerFilename = "tsc.js"; */ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) { file(outFile, prereqs, function() { - var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory; + var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; var options = "--module commonjs --noImplicitAny --noEmitOnError"; // Keep comments when specifically requested @@ -257,7 +260,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " --stripInternal" } - var cmd = host + " " + dir + compilerFilename + " " + options + " "; + var cmd = host + " " + compilerPath + " " + options + " "; cmd = cmd + sources.join(" "); console.log(cmd + "\n"); @@ -328,7 +331,7 @@ compileFile(processDiagnosticMessagesJs, // The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () { - var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson; + var cmd = host + " " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson; console.log(cmd); var ex = jake.createExec([cmd]); // Add listeners for output and error @@ -374,7 +377,7 @@ task("setDebugMode", function() { }); task("configure-nightly", [configureNightlyJs], function() { - var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs; + var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs; console.log(cmd); exec(cmd); }, { async: true }); @@ -399,13 +402,18 @@ var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDef var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js"); var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts"); -file(importDefinitelyTypedTestsJs); -file(importDefinitelyTypedTestsTs, ["tsd-scripts", importDefinitelyTypedTestsJs]) -task("importDefinitelyTyped", importDefinitelyTypedTestsTs, function () { - var cmd = "node " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped"; +file(importDefinitelyTypedTestsTs); +file(importDefinitelyTypedTestsJs, ["tsd-scripts", importDefinitelyTypedTestsTs], function () { + var cmd = host + " " + LKGCompiler + " -p " + importDefinitelyTypedTestsDirectory; console.log(cmd); exec(cmd); -}, { async: true }) +}, { async: true }); + +task("importDefinitelyTypedTests", [importDefinitelyTypedTestsJs], function () { + var cmd = host + " " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped"; + console.log(cmd); + exec(cmd); +}, { async: true }); // Local target to build the compiler and services var tscFile = path.join(builtLocalDirectory, compilerFilename); diff --git a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts index 1e673c34d32..1ae3725fff2 100644 --- a/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts +++ b/scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts @@ -107,9 +107,12 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini throw err; } + // When you just want to test the script out on one or two files, + // just add a line like the following: + // + // .filter(d => d.indexOf("sipml") >= 0 ) subDirectories .filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0) - // .filter(i => i.indexOf("sipml") >= 0 ) // Uncomment when you want to test :) .filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory()) .forEach(d => { const directoryPath = path.join(definitelyTypedRoot, d); @@ -137,7 +140,7 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini if (testFiles.length === 0) { // no test files but multiple d.ts's, e.g. winjs - let regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); + const regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))"); if (tsFiles.length > 1 && tsFiles.every(t => filePathEndsWith(t, ".d.ts") && regexp.test(t))) { for (const fileName of tsFiles) { importDefinitelyTypedTest(tscPath, rwcTestPath, path.basename(fileName, ".d.ts"), [fileName], paramFile); From e4f0ebbb3ef354fbd156aa5f1663133b01149bc7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 19 Sep 2015 00:53:15 -0700 Subject: [PATCH 68/75] Fixed links to spec in the README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c474f62fb4c..e27e7a99fa7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob * Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). * Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. * [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). -* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). +* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), [pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)). ## Documentation From 921adc89e8f1e7aba506700d341e5b9580107889 Mon Sep 17 00:00:00 2001 From: jbondc Date: Sat, 19 Sep 2015 11:43:15 -0400 Subject: [PATCH 69/75] Utilities typos + missing reference --- src/compiler/utilities.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ed8b516b7f3..a92701f5b24 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,5 @@ /// +/// /* @internal */ namespace ts { @@ -164,16 +165,16 @@ namespace ts { return node.pos; } - // Returns true if this node is missing from the actual source code. 'missing' is different - // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes - // in the tree), it is definitel missing. HOwever, a node may be defined, but still be + // Returns true if this node is missing from the actual source code. A 'missing' node is different + // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes + // in the tree), it is definitely missing. However, a node may be defined, but still be // missing. This happens whenever the parser knows it needs to parse something, but can't - // get anything in the source code that it expects at that location. For example: + // get anything in the source code that it expects at that location. For example: // // let a: ; // // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source - // code). So the parser will attempt to parse out a type, and will create an actual node. + // code). So the parser will attempt to parse out a type, and will create an actual node. // However, this node will be 'missing' in the sense that no actual source-code/tokens are // contained within it. export function nodeIsMissing(node: Node) { From 2e5b6fec7c0dcf39fdf31846787fdb50d957555a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sun, 20 Sep 2015 12:14:56 -0700 Subject: [PATCH 70/75] Add funcitonality to warn on duplicate codes. --- scripts/processDiagnosticMessages.ts | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index 0a81b993616..e40f119b382 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -10,10 +10,6 @@ interface InputDiagnosticMessageTable { [msg: string]: DiagnosticDetails; } -interface IIndexable { - [key: string]: V; -} - function main(): void { var sys = ts.sys; if (sys.args.length < 1) { @@ -25,21 +21,42 @@ function main(): void { var inputFilePath = sys.args[0].replace(/\\/g, "/"); var inputStr = sys.readFile(inputFilePath); - var diagnosticMesages: InputDiagnosticMessageTable = JSON.parse(inputStr); + var diagnosticMessages: InputDiagnosticMessageTable = JSON.parse(inputStr); - var names = Utilities.getObjectKeys(diagnosticMesages); + var names = Utilities.getObjectKeys(diagnosticMessages); var nameMap = buildUniqueNameMap(names); - var infoFileOutput = buildInfoFileOutput(diagnosticMesages, nameMap); - + var infoFileOutput = buildInfoFileOutput(diagnosticMessages, nameMap); + checkForUniqueCodes(names, diagnosticMessages); + // TODO: Fix path joining var inputDirectory = inputFilePath.substr(0,inputFilePath.lastIndexOf("/")); var fileOutputPath = inputDirectory + "/diagnosticInformationMap.generated.ts"; sys.writeFile(fileOutputPath, infoFileOutput); } -function buildUniqueNameMap(names: string[]): IIndexable { - var nameMap: IIndexable = {}; +function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) { + const originalMessageForCode: string[] = []; + + for (const currentMessage of messages) { + const code = diagnosticTable[currentMessage].code; + + if (code in originalMessageForCode) { + const originalMessage = originalMessageForCode[code]; + ts.sys.write("\x1b[93m"); // High intensity yellow. + ts.sys.write("Warning"); + ts.sys.write("\x1b[0m"); // Reset formatting. + ts.sys.write(`: Diagnostic code '${code}' conflicts between "${originalMessage}" and "${currentMessage}".`); + ts.sys.write(ts.sys.newLine + ts.sys.newLine); + } + else { + originalMessageForCode[code] = currentMessage; + } + } +} + +function buildUniqueNameMap(names: string[]): ts.Map { + var nameMap: ts.Map = {}; var uniqueNames = NameGenerator.ensureUniqueness(names, /* isCaseSensitive */ false, /* isFixed */ undefined); @@ -50,7 +67,7 @@ function buildUniqueNameMap(names: string[]): IIndexable { return nameMap; } -function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap: IIndexable): string { +function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap: ts.Map): string { var result = '// \r\n' + '/// \r\n' + @@ -172,7 +189,7 @@ module Utilities { } // Like Object.keys - export function getObjectKeys(obj: any): string[]{ + export function getObjectKeys(obj: any): string[] { var result: string[] = []; for (var name in obj) { From 942ca46637e069f1fa59a6cfdf1247b41cf1a310 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sun, 20 Sep 2015 12:16:56 -0700 Subject: [PATCH 71/75] Fixed duplicate diagnostic codes. --- .../diagnosticInformationMap.generated.ts | 12 ++--- src/compiler/diagnosticMessages.json | 47 +++++++++---------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 37989c3433a..e083acd4338 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -140,7 +140,7 @@ namespace ts { Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -190,10 +190,6 @@ namespace ts { An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -204,6 +200,10 @@ namespace ts { _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -516,7 +516,7 @@ namespace ts { Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c1657a81bab..e6ece87b5a9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -549,7 +549,7 @@ }, "An implementation cannot be declared in ambient contexts.": { "category": "Error", - "code": 1184 + "code": 1183 }, "Modifiers cannot appear here.": { "category": "Error", @@ -747,24 +747,6 @@ "category": "Error", "code": 1235 }, - "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning.": { - "category": "Error", - "code": 1236 - }, - - - "'with' statements are not allowed in an async function block.": { - "category": "Error", - "code": 1300 - }, - "'await' expression is only allowed within an async function.": { - "category": "Error", - "code": 1308 - }, - "Async functions are only available when targeting ECMAScript 6 and higher.": { - "category": "Error", - "code": 1311 - }, "The return type of a property decorator function must be either 'void' or 'any'.": { "category": "Error", "code": 1236 @@ -805,6 +787,23 @@ "category": "Error", "code": 1245 }, + "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning.": { + "category": "Error", + "code": 1246 + }, + + "'with' statements are not allowed in an async function block.": { + "category": "Error", + "code": 1300 + }, + "'await' expression is only allowed within an async function.": { + "category": "Error", + "code": 1308 + }, + "Async functions are only available when targeting ECMAScript 6 and higher.": { + "category": "Error", + "code": 1311 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 @@ -1700,11 +1699,11 @@ "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": { "category": "Error", "code": 2652 - }, + }, "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": { "category": "Error", "code": 2653 - }, + }, "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { "category": "Error", "code": 2654 @@ -1712,11 +1711,11 @@ "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": { "category": "Error", "code": 2655 - }, + }, "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": { "category": "Error", "code": 2656 - }, + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 @@ -2055,7 +2054,7 @@ }, "A 'tsconfig.json' file is already defined at: '{0}'.": { "category": "Error", - "code": 5053 + "code": 5054 }, "Concatenate and emit output to single file.": { From b265467ce7974b575d7825492b8712a714129d50 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sun, 20 Sep 2015 12:26:28 -0700 Subject: [PATCH 72/75] Accepted baselines. --- .../reference/ambientErrors.errors.txt | 20 +- .../classAbstractDeclarations.d.errors.txt | 4 +- .../constructorOverloads6.errors.txt | 4 +- .../reference/exportDeclareClass1.errors.txt | 8 +- .../reference/externSyntax.errors.txt | 4 +- ...functionsWithModifiersInBlocks1.errors.txt | 8 +- tests/baselines/reference/giant.errors.txt | 216 +++++++++--------- .../initializersInDeclarations.errors.txt | 4 +- .../methodInAmbientClass1.errors.txt | 4 +- .../parserClassDeclaration18.errors.txt | 4 +- .../parserConstructorDeclaration4.errors.txt | 4 +- .../parserFunctionDeclaration2.d.errors.txt | 4 +- .../parserFunctionDeclaration2.errors.txt | 4 +- ...arserMemberFunctionDeclaration5.errors.txt | 4 +- 14 files changed, 146 insertions(+), 146 deletions(-) diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index 16ce79a05dd..578bd44c8ec 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(6,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules. tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name. tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. @@ -44,7 +44,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export // Ambient function with function body declare function fn4() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. // Ambient enum with non - integer literal constant member declare enum E1 { @@ -67,7 +67,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export !!! error TS1039: Initializers are not allowed in ambient contexts. function fn() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. class C { static x = 3; ~ @@ -77,13 +77,13 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export !!! error TS1039: Initializers are not allowed in ambient contexts. constructor() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. fn() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static sfn() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } } diff --git a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt index 20d5ca46933..a1c0e55152c 100644 --- a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt +++ b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1242: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(17,15): error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'foo' from class 'CC'. @@ -11,7 +11,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst ~~~~~~~~ !!! error TS1242: 'abstract' modifier can only appear on a class or method declaration. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } declare abstract class AA { diff --git a/tests/baselines/reference/constructorOverloads6.errors.txt b/tests/baselines/reference/constructorOverloads6.errors.txt index 65827007a8e..34beb264f45 100644 --- a/tests/baselines/reference/constructorOverloads6.errors.txt +++ b/tests/baselines/reference/constructorOverloads6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/constructorOverloads6.ts(4,25): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/constructorOverloads6.ts(4,25): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/constructorOverloads6.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/constructorOverloads6.ts(4,25): error TS1184: An implementa constructor(n: number); constructor(x: any) { ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } bar1():void; diff --git a/tests/baselines/reference/exportDeclareClass1.errors.txt b/tests/baselines/reference/exportDeclareClass1.errors.txt index 247b0511ed1..8ff0cb52b5f 100644 --- a/tests/baselines/reference/exportDeclareClass1.errors.txt +++ b/tests/baselines/reference/exportDeclareClass1.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/exportDeclareClass1.ts (2 errors) ==== export declare class eaC { static tF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tsF(param:any) { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. }; export declare class eaC2 { diff --git a/tests/baselines/reference/externSyntax.errors.txt b/tests/baselines/reference/externSyntax.errors.txt index 1d3380b99d5..464bfcd55e4 100644 --- a/tests/baselines/reference/externSyntax.errors.txt +++ b/tests/baselines/reference/externSyntax.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/externSyntax.ts(8,20): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/externSyntax.ts(8,20): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/externSyntax.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/externSyntax.ts(8,20): error TS1184: An implementation cann public f(); public g() { } // error body ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } } diff --git a/tests/baselines/reference/functionsWithModifiersInBlocks1.errors.txt b/tests/baselines/reference/functionsWithModifiersInBlocks1.errors.txt index f6240f5e697..e3137740937 100644 --- a/tests/baselines/reference/functionsWithModifiersInBlocks1.errors.txt +++ b/tests/baselines/reference/functionsWithModifiersInBlocks1.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/functionsWithModifiersInBlocks1.ts(2,4): error TS1184: Modifiers cannot appear here. tests/cases/compiler/functionsWithModifiersInBlocks1.ts(2,21): error TS2393: Duplicate function implementation. -tests/cases/compiler/functionsWithModifiersInBlocks1.ts(2,25): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/functionsWithModifiersInBlocks1.ts(2,25): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/functionsWithModifiersInBlocks1.ts(3,4): error TS1184: Modifiers cannot appear here. tests/cases/compiler/functionsWithModifiersInBlocks1.ts(3,20): error TS2393: Duplicate function implementation. tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,4): error TS1184: Modifiers cannot appear here. tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,28): error TS2393: Duplicate function implementation. -tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/functionsWithModifiersInBlocks1.ts (8 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1184: An ~ !!! error TS2393: Duplicate function implementation. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export function f() { } ~~~~~~ !!! error TS1184: Modifiers cannot appear here. @@ -28,5 +28,5 @@ tests/cases/compiler/functionsWithModifiersInBlocks1.ts(4,32): error TS1184: An ~ !!! error TS2393: Duplicate function implementation. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 1d623870d63..2c7e6f505bd 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -44,7 +44,7 @@ tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(154,39): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(154,39): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(167,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. @@ -68,39 +68,39 @@ tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(233,39): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(238,35): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(240,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(243,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(244,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(233,39): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(238,35): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(240,24): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(243,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(244,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(245,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(245,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(246,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(247,31): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(247,31): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(248,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(249,23): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(249,23): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(250,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(251,32): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(251,32): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(252,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(254,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(254,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(255,31): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(255,31): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(256,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(257,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(257,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(258,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(262,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(262,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(267,30): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(267,30): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(282,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'. @@ -147,7 +147,7 @@ tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(412,39): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(412,39): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(425,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. @@ -171,98 +171,98 @@ tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(491,39): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(496,35): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(498,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(501,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(502,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(491,39): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(496,35): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(498,24): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(501,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(502,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(503,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(503,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(504,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(505,31): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(505,31): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(506,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(507,23): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(507,23): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(508,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(509,32): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(509,32): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(510,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(512,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(512,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(513,31): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(513,31): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(514,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(515,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(515,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(516,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(520,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(520,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(525,30): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(532,31): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(534,20): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(537,17): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(538,18): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(525,30): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(532,31): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(534,20): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(537,17): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(538,18): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(539,18): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(539,18): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(540,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(541,27): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(541,27): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(542,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(543,19): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(543,19): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(544,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(545,28): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(545,28): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(546,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(548,17): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(548,17): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(549,27): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(549,27): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(550,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(551,18): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(551,18): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(552,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(556,18): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(556,18): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(558,24): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(561,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(563,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(606,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(606,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(611,30): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(611,30): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(615,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/giant.ts(616,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. -tests/cases/compiler/giant.ts(616,39): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(616,39): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(617,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. -tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(621,26): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(623,24): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(626,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(628,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(672,22): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(672,22): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(676,30): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/giant.ts (265 errors) ==== @@ -513,7 +513,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; } @@ -640,31 +640,31 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; } export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { constructor () { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pV; private rV; public pF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -674,7 +674,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -684,7 +684,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -694,7 +694,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -703,12 +703,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -718,7 +718,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -729,7 +729,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be var V; function F() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. ~ !!! error TS1036: Statements are not allowed in ambient contexts. class C { } @@ -738,7 +738,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export var eV; export function eF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export class eC { } export interface eI { } export module eM { } @@ -977,7 +977,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; } @@ -1104,31 +1104,31 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { }; export declare module eaM { }; } export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { constructor () { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pV; private rV; public pF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1138,7 +1138,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1148,7 +1148,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1158,7 +1158,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1167,12 +1167,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1182,7 +1182,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1193,7 +1193,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be var V; function F() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. ~ !!! error TS1036: Statements are not allowed in ambient contexts. class C { } @@ -1202,7 +1202,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export var eV; export function eF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export class eC { } export interface eI { } export module eM { } @@ -1211,24 +1211,24 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export declare var eaV; export declare function eaF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { constructor () { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pV; private rV; public pF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1238,7 +1238,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1248,7 +1248,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1258,7 +1258,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1267,12 +1267,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1282,7 +1282,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1293,22 +1293,22 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be var V; function F() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. ~ !!! error TS1036: Statements are not allowed in ambient contexts. class C { constructor () { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pV; private rV; public pF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tV; static tF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } interface I { //Call Signature @@ -1363,7 +1363,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be var V; function F() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. ~ !!! error TS1036: Statements are not allowed in ambient contexts. class C { } @@ -1372,7 +1372,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export var eV; export function eF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export class eC { } export interface eI { } export module eM { } @@ -1383,7 +1383,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export declare class eaC { } ~~~~~~~ !!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -1394,20 +1394,20 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export var eV; export function eF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export class eC { constructor () { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. public pV; private rV; public pF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. static tV static tF() { } ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } export interface eI { //Call Signature @@ -1463,7 +1463,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be var V; function F() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. ~ !!! error TS1036: Statements are not allowed in ambient contexts. class C { } @@ -1471,7 +1471,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be export var eV; export function eF() { }; ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. export class eC { } export interface eI { } export module eM { } diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index 9840181e092..a3eeecfe253 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,9): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,16): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(12,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(13,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. @@ -20,7 +20,7 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(18,16): er !!! error TS1039: Initializers are not allowed in ambient contexts. fn(): boolean { ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. return false; } } diff --git a/tests/baselines/reference/methodInAmbientClass1.errors.txt b/tests/baselines/reference/methodInAmbientClass1.errors.txt index 05183378a85..2badd839270 100644 --- a/tests/baselines/reference/methodInAmbientClass1.errors.txt +++ b/tests/baselines/reference/methodInAmbientClass1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/methodInAmbientClass1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. -tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/methodInAmbientClass1.ts (2 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1184: An implementa ~~~~~~~ !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration18.errors.txt b/tests/baselines/reference/parserClassDeclaration18.errors.txt index ce4b01d5253..b5f656190bd 100644 --- a/tests/baselines/reference/parserClassDeclaration18.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration18.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration18.ts(4,25): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration18.ts(4,25): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration18.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarat constructor(n: number); constructor(x: any) { ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } bar1():void; } \ No newline at end of file diff --git a/tests/baselines/reference/parserConstructorDeclaration4.errors.txt b/tests/baselines/reference/parserConstructorDeclaration4.errors.txt index e851885f0ee..b5329a1cb47 100644 --- a/tests/baselines/reference/parserConstructorDeclaration4.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,3): error TS1031: 'declare' modifier cannot appear on a class element. -tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,25): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,25): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstru ~~~~~~~ !!! error TS1031: 'declare' modifier cannot appear on a class element. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration2.d.errors.txt b/tests/baselines/reference/parserFunctionDeclaration2.d.errors.txt index 9aee5f2b0e7..6f836544efc 100644 --- a/tests/baselines/reference/parserFunctionDeclaration2.d.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration2.d.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. -tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,14): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,14): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts (2 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDe ~~~~~~~~ !!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration2.errors.txt b/tests/baselines/reference/parserFunctionDeclaration2.errors.txt index deb96553220..f69850a5210 100644 --- a/tests/baselines/reference/parserFunctionDeclaration2.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.ts(1,24): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.ts(1,24): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.ts (1 errors) ==== declare function Foo() { ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt b/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt index 12fb40ad232..402355919a0 100644 --- a/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt +++ b/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element. -tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,19): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,19): error TS1183: An implementation cannot be declared in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts (2 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemb ~~~~~~~ !!! error TS1031: 'declare' modifier cannot appear on a class element. ~ -!!! error TS1184: An implementation cannot be declared in ambient contexts. +!!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file From 962ba8288bc44a59cdc99c5f67093353b0d8cc9b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sun, 20 Sep 2015 12:41:28 -0700 Subject: [PATCH 73/75] Conflicts should cause errors instead of warnings. --- scripts/processDiagnosticMessages.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index e40f119b382..1eead82d9fe 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -37,22 +37,29 @@ function main(): void { function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) { const originalMessageForCode: string[] = []; + let numConflicts = 0; for (const currentMessage of messages) { const code = diagnosticTable[currentMessage].code; if (code in originalMessageForCode) { const originalMessage = originalMessageForCode[code]; - ts.sys.write("\x1b[93m"); // High intensity yellow. - ts.sys.write("Warning"); + ts.sys.write("\x1b[91m"); // High intensity red. + ts.sys.write("Error"); ts.sys.write("\x1b[0m"); // Reset formatting. ts.sys.write(`: Diagnostic code '${code}' conflicts between "${originalMessage}" and "${currentMessage}".`); ts.sys.write(ts.sys.newLine + ts.sys.newLine); + + numConflicts++; } else { originalMessageForCode[code] = currentMessage; } } + + if (numConflicts > 0) { + throw new Error(`Found ${numConflicts} conflict(s) in diagnostic codes.`); + } } function buildUniqueNameMap(names: string[]): ts.Map { From c5a85c761f873c5b3a1890e51f52d960a78fc906 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Sep 2015 02:06:36 -0700 Subject: [PATCH 74/75] Update LKG --- lib/lib.core.es6.d.ts | 29 +++++++- lib/lib.dom.d.ts | 2 +- lib/lib.es6.d.ts | 29 +++++++- lib/lib.webworker.d.ts | 2 +- lib/tsc.js | 149 +++----------------------------------- lib/tsserver.js | 15 +++- lib/typescript.js | 26 ++++--- lib/typescriptServices.js | 26 ++++--- 8 files changed, 114 insertions(+), 164 deletions(-) diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts index fd115497f8a..6d6a68559f8 100644 --- a/lib/lib.core.es6.d.ts +++ b/lib/lib.core.es6.d.ts @@ -3965,7 +3965,34 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index ac031db886b..849560ac0d2 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -13192,4 +13192,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index abced59c41a..75ba647a128 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -3965,7 +3965,34 @@ interface ObjectConstructor { * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index b560065ef39..85bcfb1498e 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -1199,4 +1199,4 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file diff --git a/lib/tsc.js b/lib/tsc.js index 3983b8c1e1b..3d2b7f3956a 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -47,7 +47,6 @@ var ts; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); -/// var ts; (function (ts) { function createFileMap(getCanonicalFileName) { @@ -569,9 +568,6 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { - // Get root length of http://www.website.com/folder1/foler2/ - // In this example the root is: http://www.website.com/ - // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { @@ -731,7 +727,6 @@ var ts; Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.sys = (function () { @@ -1003,7 +998,6 @@ var ts; } })(); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.Diagnostics = { @@ -1624,8 +1618,6 @@ var ts; A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { function tokenIsIdentifierOrKeyword(token) { @@ -1879,16 +1871,6 @@ var ts; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - // ES5 7.3: - // The ECMAScript line terminator characters are listed in Table 3. - // Table 3: Line Terminator Characters - // Code Unit Value Name Formal Name - // \u000A Line Feed - // \u000D Carriage Return - // \u2028 Line separator - // \u2029 Paragraph separator - // Only the characters in Table 3 are treated as line terminators. Other new line or line - // breaking characters are treated as white space but not as line terminators. return ch === 10 || ch === 13 || ch === 8232 || @@ -2990,7 +2972,6 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); -/// var ts; (function (ts) { ts.bindTime = 0; @@ -3704,7 +3685,6 @@ var ts; } } })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { @@ -5653,8 +5633,6 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var nodeConstructors = new Array(270); @@ -6145,10 +6123,6 @@ var ts; } } function fixupParentReferences(sourceFile) { - // normally parent references are set during binding. However, for clients that only need - // a syntax tree, and no semantic features, then the binding process is an unnecessary - // overhead. This functions allows us to set all the parents, without all the expense of - // binding. var parent = sourceFile; forEachChild(sourceFile, visitNode); return; @@ -7480,9 +7454,6 @@ var ts; return allowInAnd(parseExpression); } function parseExpression() { - // Expression[in]: - // AssignmentExpression[in] - // Expression[in] , AssignmentExpression[in] var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); @@ -7507,15 +7478,6 @@ var ts; return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { - // AssignmentExpression[in,yield]: - // 1) ConditionalExpression[?in,?yield] - // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] - // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] - // 4) ArrowFunctionExpression[?in,?yield] - // 5) [+Yield] YieldExpression[?In] - // - // Note: for ease of implementation we treat productions '2' and '3' as the same thing. - // (i.e. they're both BinaryExpressions with an assignment operator in it). if (isYieldExpression()) { return parseYieldExpression(); } @@ -8484,8 +8446,6 @@ var ts; return finishNode(node); } function parseThrowStatement() { - // ThrowStatement[Yield] : - // throw [no LineTerminator here]Expression[In, ?Yield]; var node = createNode(206); parseExpected(96); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); @@ -9097,8 +9057,6 @@ var ts; return finishNode(node); } function parseHeritageClauses(isClassHeritageClause) { - // ClassTail[Yield,Await] : (Modified) See 14.5 - // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } if (isHeritageClause()) { return parseList(20, parseHeritageClause); } @@ -9265,12 +9223,6 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - // ImportClause: - // ImportedDefaultBinding - // NameSpaceImport - // NamedImports - // ImportedDefaultBinding, NameSpaceImport - // ImportedDefaultBinding, NamedImports var importClause = createNode(221, fullStart); if (identifier) { importClause.name = identifier; @@ -10227,7 +10179,6 @@ var ts; } })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var nextSymbolId = 1; @@ -15562,8 +15513,8 @@ var ts; } } function getContextuallyTypedParameterType(parameter) { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + var func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -18126,10 +18077,6 @@ var ts; } } function checkParameter(node) { - // Grammar checking - // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the - // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code - // or if its FunctionBody is strict code(11.1.5). checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); @@ -18772,15 +18719,6 @@ var ts; return type; } function getPromisedType(promise) { - // - // { // promise - // then( // thenFunction - // onfulfilled: ( // onfulfilledParameterType - // value: T // valueParameterType - // ) => any - // ): any; - // } - // if (promise.flags & 1) { return undefined; } @@ -19123,9 +19061,6 @@ var ts; } } function checkVarDeclaredNamesNotShadowed(node) { - // - ScriptBody : StatementList - // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList - // also occurs in the VarDeclaredNames of StatementList. if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } @@ -19801,19 +19736,6 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { - // TypeScript 1.0 spec (April 2014): 8.2.3 - // A derived class inherits all members from its base class it doesn't override. - // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. - // Both public and private property members are inherited, but only public property members can be overridden. - // A property member in a derived class is said to override a property member in a base class - // when the derived class property member has the same name and kind(instance or static) - // as the base class property member. - // The type of an overriding property member must be assignable(section 3.8.4) - // to the type of the overridden property member, or otherwise a compile - time error occurs. - // Base class instance member functions can be overridden by derived class instance member functions, - // but not by other kinds of members. - // Base class instance member variables and accessors can be overridden by - // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; @@ -22347,7 +22269,6 @@ var ts; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { @@ -23675,8 +23596,6 @@ var ts; } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { function isExternalModuleOrDeclarationFile(sourceFile) { @@ -24416,19 +24335,6 @@ var ts; write(")"); } function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar ts.Debug.assert(node.templateSpans.length !== 0); return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; } @@ -24775,8 +24681,15 @@ var ts; } else if (declaration.kind === 224) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); + var name = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + if (languageVersion === 0 && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } return; } } @@ -25769,26 +25682,6 @@ var ts; emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. var endPos = emitToken(84, node.pos); write(" "); endPos = emitToken(17, endPos); @@ -28519,17 +28412,6 @@ var ts; write("});"); } function emitAMDDependencies(node, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list var aliasedModuleNames = []; var unaliasedModuleNames = []; var importAliasNames = []; @@ -29441,9 +29323,6 @@ var ts; "diams": 0x2666 }; })(ts || (ts = {})); -/// -/// -/// var ts; (function (ts) { ts.programTime = 0; @@ -30288,10 +30167,6 @@ var ts; } ts.createProgram = createProgram; })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { ts.optionDeclarations = [ @@ -30750,8 +30625,6 @@ var ts; } ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { function validateLocaleAndSetLanguage(locale, errors) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 875e63028b2..82199e1222d 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -15971,8 +15971,8 @@ var ts; } } function getContextuallyTypedParameterType(parameter) { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + var func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -25139,8 +25139,15 @@ var ts; } else if (declaration.kind === 224) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); + var name = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + if (languageVersion === 0 && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } return; } } diff --git a/lib/typescript.js b/lib/typescript.js index 2c70f56d0a6..a1f9651570e 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -4954,6 +4954,7 @@ var ts; } })(ts || (ts = {})); /// +/// /* @internal */ var ts; (function (ts) { @@ -5083,16 +5084,16 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; - // Returns true if this node is missing from the actual source code. 'missing' is different - // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes - // in the tree), it is definitel missing. HOwever, a node may be defined, but still be + // Returns true if this node is missing from the actual source code. A 'missing' node is different + // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes + // in the tree), it is definitely missing. However, a node may be defined, but still be // missing. This happens whenever the parser knows it needs to parse something, but can't - // get anything in the source code that it expects at that location. For example: + // get anything in the source code that it expects at that location. For example: // // let a: ; // // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source - // code). So the parser will attempt to parse out a type, and will create an actual node. + // code). So the parser will attempt to parse out a type, and will create an actual node. // However, this node will be 'missing' in the sense that no actual source-code/tokens are // contained within it. function nodeIsMissing(node) { @@ -18922,8 +18923,8 @@ var ts; } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + var func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29868,8 +29869,15 @@ var ts; else if (declaration.kind === 224 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); + var name = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + if (languageVersion === 0 /* ES3 */ && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } return; } } diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 2c70f56d0a6..a1f9651570e 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -4954,6 +4954,7 @@ var ts; } })(ts || (ts = {})); /// +/// /* @internal */ var ts; (function (ts) { @@ -5083,16 +5084,16 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; - // Returns true if this node is missing from the actual source code. 'missing' is different - // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes - // in the tree), it is definitel missing. HOwever, a node may be defined, but still be + // Returns true if this node is missing from the actual source code. A 'missing' node is different + // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes + // in the tree), it is definitely missing. However, a node may be defined, but still be // missing. This happens whenever the parser knows it needs to parse something, but can't - // get anything in the source code that it expects at that location. For example: + // get anything in the source code that it expects at that location. For example: // // let a: ; // // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source - // code). So the parser will attempt to parse out a type, and will create an actual node. + // code). So the parser will attempt to parse out a type, and will create an actual node. // However, this node will be 'missing' in the sense that no actual source-code/tokens are // contained within it. function nodeIsMissing(node) { @@ -18922,8 +18923,8 @@ var ts; } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + var func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29868,8 +29869,15 @@ var ts; else if (declaration.kind === 224 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); + var name = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name); + if (languageVersion === 0 /* ES3 */ && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } return; } } From d409ba785cf29ba3a6ea123f4cdba4ad46cf3c69 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 21 Sep 2015 16:58:45 -0700 Subject: [PATCH 75/75] Delete generated file, add to gitignore --- .gitignore | 3 +- .../diagnosticInformationMap.generated.ts | 622 ------------------ 2 files changed, 2 insertions(+), 623 deletions(-) delete mode 100644 src/compiler/diagnosticInformationMap.generated.ts diff --git a/.gitignore b/.gitignore index 9a513646e9c..9362eb8d69c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ tests/services/baselines/local/* tests/baselines/prototyping/local/* tests/baselines/rwc/* tests/baselines/test262/* -tests/baselines/reference/projectOutput/* +tests/baselines/reference/projectOutput/* tests/baselines/local/projectOutput/* tests/services/baselines/prototyping/local/* tests/services/browser/typescriptServices.js @@ -30,6 +30,7 @@ scripts/processDiagnosticMessages.d.ts scripts/processDiagnosticMessages.js scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js src/harness/*.js +src/compiler/diagnosticInformationMap.generated.ts rwc-report.html *.swp build.json diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts deleted file mode 100644 index e083acd4338..00000000000 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ /dev/null @@ -1,622 +0,0 @@ -// -/// -/* @internal */ -namespace ts { - export var Diagnostics = { - Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." }, - _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, - Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used in an ambient context." }, - _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with a class declaration." }, - _0_modifier_cannot_be_used_here: { code: 1042, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used here." }, - _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." }, - A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, - Type_0_is_not_a_valid_async_function_return_type: { code: 1055, category: DiagnosticCategory.Error, key: "Type '{0}' is not a valid async function return type." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: DiagnosticCategory.Error, key: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: DiagnosticCategory.Error, key: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: DiagnosticCategory.Error, key: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: DiagnosticCategory.Error, key: "Expression body for async arrow function does not have a valid callable 'then' member." }, - Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, - An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." }, - Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: DiagnosticCategory.Error, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: DiagnosticCategory.Error, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: DiagnosticCategory.Error, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: DiagnosticCategory.Error, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: DiagnosticCategory.Error, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: DiagnosticCategory.Error, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." }, - Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: DiagnosticCategory.Error, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: DiagnosticCategory.Error, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." }, - Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, - A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator body." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - Module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "Module '{0}' has no default export." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, - Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, - Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." }, - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, - Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, - Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, - Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Modules are automatically in strict mode." }, - Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." }, - Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." }, - Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: DiagnosticCategory.Error, key: "Generators are not allowed in an ambient context." }, - An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: DiagnosticCategory.Error, key: "An overload signature cannot be declared as a generator." }, - _0_tag_already_specified: { code: 1223, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." }, - Signature_0_must_have_a_type_predicate: { code: 1224, category: DiagnosticCategory.Error, key: "Signature '{0}' must have a type predicate." }, - Cannot_find_parameter_0: { code: 1225, category: DiagnosticCategory.Error, key: "Cannot find parameter '{0}'." }, - Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: DiagnosticCategory.Error, key: "Type predicate '{0}' is not assignable to '{1}'." }, - Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: DiagnosticCategory.Error, key: "Parameter '{0}' is not in the same position as parameter '{1}'." }, - A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: DiagnosticCategory.Error, key: "A type predicate is only allowed in return type position for functions and methods." }, - A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: DiagnosticCategory.Error, key: "A type predicate cannot reference a rest parameter." }, - A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: DiagnosticCategory.Error, key: "A type predicate cannot reference element '{0}' in a binding pattern." }, - An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: DiagnosticCategory.Error, key: "An export assignment can only be used in a module." }, - An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: DiagnosticCategory.Error, key: "An import declaration can only be used in a namespace or module." }, - An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, - An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, - A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, - The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, - Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, - Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: DiagnosticCategory.Error, key: "Unable to resolve signature of parameter decorator when called as an expression." }, - Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: DiagnosticCategory.Error, key: "Unable to resolve signature of property decorator when called as an expression." }, - Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: DiagnosticCategory.Error, key: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_or_method_declaration: { code: 1242, category: DiagnosticCategory.Error, key: "'abstract' modifier can only appear on a class or method declaration." }, - _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, - Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, - Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1246, category: DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, - Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_a_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not a module." }, - Cannot_find_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find module '{0}'." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: DiagnosticCategory.Error, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: DiagnosticCategory.Error, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: DiagnosticCategory.Error, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: DiagnosticCategory.Error, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: DiagnosticCategory.Error, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: DiagnosticCategory.Error, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: DiagnosticCategory.Error, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: DiagnosticCategory.Error, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: DiagnosticCategory.Error, key: "Super calls are not permitted outside constructors or in nested functions inside constructors." }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: DiagnosticCategory.Error, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class." }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: DiagnosticCategory.Error, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: DiagnosticCategory.Error, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: DiagnosticCategory.Error, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: DiagnosticCategory.Error, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: DiagnosticCategory.Error, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: DiagnosticCategory.Error, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: DiagnosticCategory.Error, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: DiagnosticCategory.Error, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: DiagnosticCategory.Error, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: DiagnosticCategory.Error, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: DiagnosticCategory.Error, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: DiagnosticCategory.Error, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: DiagnosticCategory.Error, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: DiagnosticCategory.Error, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: DiagnosticCategory.Error, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: DiagnosticCategory.Error, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: DiagnosticCategory.Error, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: DiagnosticCategory.Error, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: DiagnosticCategory.Error, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: DiagnosticCategory.Error, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: DiagnosticCategory.Error, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: DiagnosticCategory.Error, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: DiagnosticCategory.Error, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: DiagnosticCategory.Error, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: DiagnosticCategory.Error, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: DiagnosticCategory.Error, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: DiagnosticCategory.Error, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: DiagnosticCategory.Error, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: DiagnosticCategory.Error, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: DiagnosticCategory.Error, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: DiagnosticCategory.Error, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: DiagnosticCategory.Error, key: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: DiagnosticCategory.Error, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: DiagnosticCategory.Error, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: DiagnosticCategory.Error, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: DiagnosticCategory.Error, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: DiagnosticCategory.Error, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: DiagnosticCategory.Error, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: DiagnosticCategory.Error, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: DiagnosticCategory.Error, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: DiagnosticCategory.Error, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: DiagnosticCategory.Error, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: DiagnosticCategory.Error, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: DiagnosticCategory.Error, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, - Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: DiagnosticCategory.Error, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: DiagnosticCategory.Error, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: DiagnosticCategory.Error, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: DiagnosticCategory.Error, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: DiagnosticCategory.Error, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: DiagnosticCategory.Error, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...of' statement." }, - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, - An_iterator_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "An iterator must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, - Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, - An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, - A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, - A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, - _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, - Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, - No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." }, - A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." }, - _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own base expression." }, - Type_0_is_not_a_constructor_function_type: { code: 2507, category: DiagnosticCategory.Error, key: "Type '{0}' is not a constructor function type." }, - No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: DiagnosticCategory.Error, key: "No base constructor has the specified number of type arguments." }, - Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: DiagnosticCategory.Error, key: "Base constructor return type '{0}' is not a class or interface type." }, - Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: DiagnosticCategory.Error, key: "Base constructors must all have the same return type." }, - Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: DiagnosticCategory.Error, key: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_not_abstract: { code: 2512, category: DiagnosticCategory.Error, key: "Overload signatures must all be abstract or not abstract." }, - Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: DiagnosticCategory.Error, key: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, - Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." }, - Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, - All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." }, - Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, - Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." }, - Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, - Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, - The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, - yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, - await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, - Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, - JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, - The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, - JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: DiagnosticCategory.Error, key: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, - JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: DiagnosticCategory.Error, key: "JSX element type '{0}' does not have any construct or call signatures." }, - JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: DiagnosticCategory.Error, key: "JSX element type '{0}' is not a constructor function for JSX elements." }, - Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: DiagnosticCategory.Error, key: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: DiagnosticCategory.Error, key: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: DiagnosticCategory.Error, key: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, - A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, - Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, - Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, - Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, - Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, - Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: DiagnosticCategory.Error, key: "Default export of the module has or is using private name '{0}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: DiagnosticCategory.Error, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.Error, key: "Unsupported file encoding." }, - Failed_to_parse_file_0_Colon_1: { code: 5014, category: DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, - Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, - Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, - Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, - Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" }, - options: { code: 6024, category: DiagnosticCategory.Message, key: "options" }, - file: { code: 6025, category: DiagnosticCategory.Message, key: "file" }, - Examples_Colon_0: { code: 6026, category: DiagnosticCategory.Message, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: DiagnosticCategory.Message, key: "Options:" }, - Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: DiagnosticCategory.Message, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: DiagnosticCategory.Message, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: DiagnosticCategory.Message, key: "KIND" }, - FILE: { code: 6035, category: DiagnosticCategory.Message, key: "FILE" }, - VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" }, - LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: DiagnosticCategory.Message, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." }, - File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, - File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, - NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, - Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, - Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, - Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, - Successfully_created_a_tsconfig_json_file: { code: 6071, category: DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." }, - Suppress_excess_property_checks_for_object_literals: { code: 6072, category: DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: DiagnosticCategory.Error, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: DiagnosticCategory.Error, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: DiagnosticCategory.Error, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: DiagnosticCategory.Error, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: DiagnosticCategory.Error, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: DiagnosticCategory.Error, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: DiagnosticCategory.Error, key: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, - You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." }, - export_can_only_be_used_in_a_ts_file: { code: 8003, category: DiagnosticCategory.Error, key: "'export=' can only be used in a .ts file." }, - type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: DiagnosticCategory.Error, key: "'type parameter declarations' can only be used in a .ts file." }, - implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in a .ts file." }, - interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in a .ts file." }, - module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in a .ts file." }, - type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in a .ts file." }, - _0_can_only_be_used_in_a_ts_file: { code: 8009, category: DiagnosticCategory.Error, key: "'{0}' can only be used in a .ts file." }, - types_can_only_be_used_in_a_ts_file: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in a .ts file." }, - type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in a .ts file." }, - parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in a .ts file." }, - property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in a .ts file." }, - enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." }, - type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." }, - decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, - class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." }, - JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: DiagnosticCategory.Error, key: "JSX attributes must only be assigned a non-empty 'expression'." }, - JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: DiagnosticCategory.Error, key: "JSX elements cannot have multiple attributes with the same name." }, - Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, - JSX_attribute_expected: { code: 17003, category: DiagnosticCategory.Error, key: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, - }; -} \ No newline at end of file