TypeScript/tests/cases/compiler/objectInstantiationFromUnionSpread.ts
Anders Hejlsberg 3918e6c535
Move anonymous type instantiation cache from AST node to root type (#41084)
* Move anonymous type instantiation cache from AST node to root type

* Use "root" type reference as cache location for deferred type references

* Add test

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-19 07:26:48 -07:00

22 lines
315 B
TypeScript

// @strictFunctionTypes: true
// #40995
interface Success {
isSuccess: true;
}
interface Fail {
isSuccess: false;
}
type Item = Success | Fail;
function f1(a: Item[]) {
a.map(item => ({ ...item })).filter(value => {});
}
function f2<T>(a: Item[]) {
a.map(item => ({ ...item })).filter(value => {});
}