diff --git a/TypeScript b/TypeScript index 0041d5c..e62f118 160000 --- a/TypeScript +++ b/TypeScript @@ -1 +1 @@ -Subproject commit 0041d5ce7907f9ee974693ace54efd64afa1971a +Subproject commit e62f1181b6a94161f8bfa88a84c2cf4c0f66bc3a diff --git a/bin/ntypescript.js b/bin/ntypescript.js index 8fbdd62..d8a50ff 100644 --- a/bin/ntypescript.js +++ b/bin/ntypescript.js @@ -10251,6 +10251,7 @@ var ts; token() === 25 /* LessThanToken */ || token() === 53 /* QuestionToken */ || token() === 54 /* ColonToken */ || + token() === 24 /* CommaToken */ || canParseSemicolon(); } return false; @@ -33492,7 +33493,13 @@ var ts; (augmentations || (augmentations = [])).push(file.moduleAugmentations); } if (file.symbol && file.symbol.globalExports) { - mergeSymbolTable(globals, file.symbol.globalExports); + // Merge in UMD exports with first-in-wins semantics (see #9771) + var source = file.symbol.globalExports; + for (var id in source) { + if (!(id in globals)) { + globals[id] = source[id]; + } + } } }); if (augmentations) { @@ -36799,8 +36806,10 @@ var ts; // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); - // If optional property emit ? - if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || node.kind === 142 /* Parameter */) && ts.hasQuestionToken(node)) { + // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor + // we don't want to emit property declaration with "?" + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || + (node.kind === 142 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) && node.parent.kind === 159 /* TypeLiteral */) { @@ -43495,7 +43504,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 230 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = node.kind === 230 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); diff --git a/bin/typescript.js b/bin/typescript.js index 70f5d35..76be0ba 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -10251,6 +10251,7 @@ var ts; token() === 25 /* LessThanToken */ || token() === 53 /* QuestionToken */ || token() === 54 /* ColonToken */ || + token() === 24 /* CommaToken */ || canParseSemicolon(); } return false; @@ -33492,7 +33493,13 @@ var ts; (augmentations || (augmentations = [])).push(file.moduleAugmentations); } if (file.symbol && file.symbol.globalExports) { - mergeSymbolTable(globals, file.symbol.globalExports); + // Merge in UMD exports with first-in-wins semantics (see #9771) + var source = file.symbol.globalExports; + for (var id in source) { + if (!(id in globals)) { + globals[id] = source[id]; + } + } } }); if (augmentations) { @@ -36799,8 +36806,10 @@ var ts; // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); - // If optional property emit ? - if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || node.kind === 142 /* Parameter */) && ts.hasQuestionToken(node)) { + // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor + // we don't want to emit property declaration with "?" + if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || + (node.kind === 142 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) && node.parent.kind === 159 /* TypeLiteral */) { @@ -43495,7 +43504,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 230 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = node.kind === 230 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); diff --git a/kicktravis b/kicktravis index c2d34f1..3e6350e 100644 --- a/kicktravis +++ b/kicktravis @@ -1 +1 @@ -2016-08-26 [ci skip] Version: 1.201608260007.1+0041d5ce7907f9ee974693ace54efd64afa1971a +2016-08-27 [ci skip] Version: 1.201608270006.1+e62f1181b6a94161f8bfa88a84c2cf4c0f66bc3a diff --git a/package.json b/package.json index 81e16e6..3ca318d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ntypescript", - "version": "1.201608260007.1+0041d5ce7907f9ee974693ace54efd64afa1971a", + "version": "1.201608270006.1+e62f1181b6a94161f8bfa88a84c2cf4c0f66bc3a", "description": "A nicer version of microsoft/typescript packaged and released for API developers", "main": "./bin/ntypescript.js", "bin": { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2341a0f..8c1e401 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18763,7 +18763,13 @@ namespace ts { (augmentations || (augmentations = [])).push(file.moduleAugmentations); } if (file.symbol && file.symbol.globalExports) { - mergeSymbolTable(globals, file.symbol.globalExports); + // Merge in UMD exports with first-in-wins semantics (see #9771) + const source = file.symbol.globalExports; + for (const id in source) { + if (!(id in globals)) { + globals[id] = source[id]; + } + } } }); diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 3642ee7..ab1ca51 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -1132,8 +1132,10 @@ namespace ts { // it if it's not a well known symbol. In that case, the text of the name will be exactly // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); - // If optional property emit ? - if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.Parameter) && hasQuestionToken(node)) { + // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor + // we don't want to emit property declaration with "?" + if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || + (node.kind === SyntaxKind.Parameter && !isParameterPropertyDeclaration(node))) && hasQuestionToken(node)) { write("?"); } if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d0f7918..f02cf26 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6587,7 +6587,7 @@ const _super = (function (geti, seti) { // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - const isNakedImport = SyntaxKind.ImportDeclaration && !(node).importClause; + const isNakedImport = node.kind === SyntaxKind.ImportDeclaration && !(node).importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b5ba898..b28f13e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2339,6 +2339,7 @@ namespace ts { token() === SyntaxKind.LessThanToken || token() === SyntaxKind.QuestionToken || token() === SyntaxKind.ColonToken || + token() === SyntaxKind.CommaToken || canParseSemicolon(); } return false;