-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
I`m switching from TS 0.9.5 to 1.1 CTP and have this simplified .d.ts:
interface FooArray<T> extends Foo<T[]> {
subscribeTo(transform?: (val: any) => T): FooArray<T>;
}
interface Foo<T> {
subscribeTo(transform?: (val: any) => T): Foo<T>;
}
Compilation has failed failed with:
error TS2429: Interface 'FooArray' incorrectly extends interface 'Foo<T[]>':
Types of property 'subscribeTo' are incompatible:
Type '(transform?: (val: any) => T) => Foo' is not assignable to type '(transform?: (val: any) => T[]) => Foo<T[]>':
Types of parameters 'transform' and 'transform' are incompatible:
Type '(val: any) => T' is not assignable to type '(val: any) => T[]':
Type 'T' is not assignable to type 'T[]':
Property 'length' is missing in type '{}'.
Note that the TS 0.9.5 compiles the below code while 1.0/1.1-CTP does not.
Questions:
- Shouldn't FooArray.subscribeTo should be treated as an overload and added to the FooArray`s contract? I.e. FooArray will have two subscribeTo methods.
- How to fix it?
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code