Merge pull request #26751 from Microsoft/declarationEmitWithComposite

Correctly mark visibile nodes when declaration isnt explicitly turned on but composite is true
This commit is contained in:
Sheetal Nandi
2018-08-29 22:55:01 -07:00
committed by GitHub
5 changed files with 50 additions and 2 deletions

View File

@@ -26356,7 +26356,7 @@ namespace ts {
function checkExportSpecifier(node: ExportSpecifier) {
checkAliasSymbol(node);
if (compilerOptions.declaration) {
if (getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.propertyName || node.name, /*setVisibility*/ true);
}
if (!node.parent.parent.moduleSpecifier) {
@@ -26397,7 +26397,7 @@ namespace ts {
if (node.expression.kind === SyntaxKind.Identifier) {
markExportAsReferenced(node);
if (compilerOptions.declaration) {
if (getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression as Identifier, /*setVisibility*/ true);
}
}

View File

@@ -0,0 +1,17 @@
//// [test.ts]
interface Foo {
x: number;
}
export default Foo;
//// [/foo/out/test.js]
"use strict";
exports.__esModule = true;
//// [/foo/out/test.d.ts]
interface Foo {
x: number;
}
export default Foo;

View File

@@ -0,0 +1,10 @@
=== /foo/test.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))
x: number;
>x : Symbol(Foo.x, Decl(test.ts, 0, 15))
}
export default Foo;
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))

View File

@@ -0,0 +1,8 @@
=== /foo/test.ts ===
interface Foo {
x: number;
>x : number
}
export default Foo;
>Foo : Foo

View File

@@ -0,0 +1,13 @@
// @composite: true
// @fullEmitPaths: true
// @filename: /foo/tsconfig.json
{
"compilerOptions": { "composite": true, "outDir": "out" }
}
// @filename: /foo/test.ts
interface Foo {
x: number;
}
export default Foo;