Closed
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
};