Not sure if I found a bug or not, so just checking first. The code below should not work, but it compiles fine:
interface IType<TInstance> {
new (value: boolean, ...args: any[]): TInstance;
}
class Test<T extends string> {
constructor(value: T) { }
}
function doSomething(_type: IType<any>) { }
doSomething(Test);
(here)
If I change constructor(value: T) { } to constructor(value: string) { } it fails. It should fail anyhow, since T could NEVER be of the expected type. :/
This also just seems wrong:
interface IType<TInstance> {
new (value: boolean, ...args: any[]): TInstance;
}
class Test<T extends Object> {
constructor(value: T) { }
}
function doSomething(_type: IType<any>) { }
doSomething(Test);
class O extends Object { }
class TO extends Test<O> { }
doSomething(TO);
Compiles just fine. :/
Not sure if I found a bug or not, so just checking first. The code below should not work, but it compiles fine:
(here)
If I change
constructor(value: T) { }toconstructor(value: string) { }it fails. It should fail anyhow, since T could NEVER be of the expected type. :/This also just seems wrong:
Compiles just fine. :/