We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx) with strictNullChecks
Code
//example 1: interface MyInterface<T> { someMethod: (param1: T) => MyInterface<T>; } class MyInterfaceImpl<T> implements MyInterface<T>{ someMethod = function (param1: T) { return new MyInterfaceImpl<T>(); } } let getMyInterface: () => MyInterface<{}> = () => { return new MyInterfaceImpl<{}>(); }; let getString: () => MyInterface<string> = getMyInterface; let getDate: () => MyInterface<Date> = getMyInterface; let getNumber: () => MyInterface<number> = getMyInterface; //example 2: let getPromise1: () => Promise<{} | number> = () => { return Promise.resolve({}) }; let getStringP1: () => Promise<string> = getPromise1 let getDateP1: () => Promise<Date> = getPromise1 let getNumberP1: () => Promise<number> = getPromise1 //example 3: let getPromise2: () => Promise<{} | number| undefined | null> = () => { return Promise.resolve({}) }; let getStringP2: () => Promise<string> = getPromise2 let getDateP2: () => Promise<Date> = getPromise2 let getNumberP2: () => Promise<number> = getPromise2
Expected behavior: Should not compile with error like 'Type () =>Promise<X> is not assignable to type '() => Promise<Y>'. Actual behavior: Compiles.
The text was updated successfully, but these errors were encountered:
#14298 - I think it is related.
Sorry, something went wrong.
Duplicate of #13970
No branches or pull requests
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
with strictNullChecks
Code
Expected behavior:
Should not compile with error like 'Type () =>Promise<X> is not assignable to type '() => Promise<Y>'.
Actual behavior:
Compiles.
The text was updated successfully, but these errors were encountered: