-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 files
Milestone
Description
TypeScript Version: 3.1.0-dev.20180802
Search Terms: missing import in declarations, destructuring with imported constant
Code
context.ts
export const Key = Symbol();
export interface Context {
[Key]: string;
}
index.ts
import { Key, Context } from "./context";
export const context: Context = {
[Key]: 'bar',
}
export const withContext = ({ [Key]: value }: Context) => value;
tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true,
"esModuleInterop": true
}
}
Expected behavior:
Generated declaration index.d.ts
references Key
and so it should also import it.
Actual behavior:
Key
is referenced in the signature of withContext
but does not import it:
import { Context } from "./context"; // Key is missing from this import
export declare const context: Context;
export declare const withContext: ({ [Key]: value }: Context) => string;
// ^^^ Key is referenced here
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 files