-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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.4.1
Code
declare type Newable<TType> = {
new (...params: any[]): TType;
};
interface Bar<T>{
(): T;
}
const FooBar = {};
class Foo<TItem> extends (FooBar as any as Newable<Bar<TItem>>) {
}Expected behavior:
The generated declaration file should contain the following
declare type Newable<TType> = {
new (...params: any[]): TType;
};
interface Bar<T> {
(): T;
}
declare const FooBar: {};
declare const Foo_base: Newable<Bar<any>>;
declare class Foo<TItem> extends Foo_base {
}Actual behavior:
declare type Newable<TType> = {
new (...params: any[]): TType;
};
interface Bar<T> {
(): T;
}
declare const FooBar: {};
declare const Foo_base: Newable<Bar<TItem>>; // <----- TItem is not defined
declare class Foo<TItem> extends Foo_base {
}When the generated declarations file is referenced by other code, the compilation fails with
error TS2304: Build:Cannot find name 'TItem'.
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