-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.7.0-dev.20171102
Code
// test.ts
import * as ts from "typescript";
export const someVar = {
[ts.SyntaxKind.SourceFile]: ""
};
Compile with: tsc test.ts --declaration --module commonjs
Expected behavior:
Expect the declaration file to export as it did in TS 2.5.3:
export declare const someVar: {
[key: number]: string;
};
...or at least throw a compile error when compiling with --declaration
.
Actual behavior:
export declare const someVar: {
[ts.SyntaxKind.SourceFile]: string;
};
No compile error.
Another example
Here's another example that doesn't error with --declaration
, even though I'm using a private name:
// test.ts
enum MyEnum {
member = 0
}
export const someVar = {
[MyEnum.member]: ""
};
// output: test.d.ts (and no compile error)
export const someVar = {
[MyEnum.member]: string
};
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issueA PR has been merged for this issue