GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing github.com — Covariant checking for callback parameters by ahejlsberg · Pull Request #15104 · microsoft/TypeScript Conversation
|
|
Mohamed Hegazy (@mhegazy) Want to take a look? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Shawn Talbert (@ShawnTalbert) If not clear. This PR does not introduce any new syntax. Instead changes type assignability of generics where the type is only user in a function parameter position e.g Promise / Observable interface Box<T> { foo(cb: (t: T => void)): void; } Before: declare const bA: Box<Animal>; const bC: Box<Cat> = bA; // no error 😿 After: declare const bA: Box<Animal>; const bC: Box<Cat> = bA; // error 😺 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, wrong issue, sorry |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It appears that the solution was amended to ignore union with null/undefined. Should that be dependent on --strictNullChecks? At the moment, this does not seem to address #13513. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Brian McBarron (@bmcbarron) #13513 is fixed by this PR in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
never instead of void for Observable type arguments
DefinitelyTyped/DefinitelyTyped#17248
There was an error while loading. Please reload this page.
|
This doesn't fix this problem unfortunately and this is usually the case if the callbacks are stored in different files and imported. class Animal {} class Cat extends Animal { public meow() {} } let promise: Promise<Animal> = null; promise.then((cat: Cat) => { //Should error here but does not cat.meow(); }); |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.