6aeb8c12cc
* Create separate types for equivalent aliased unions * Accept new baselines * Preserve original types for union types * Accept new baselines * Preserve intersection origin for union types * Accept new baselines * Accept new baselines * Preserve aliases during relationship checks * Accept new baselines * Preserve aliases for intersection and indexed access types * Accept new baselines * Compute intersection-of-unions cross product without recursion * Accept new baselines * Use denormalized type objects for origin / support 'keyof' origins * Accept new baselines * Fix fourslash test * Recursively extract named union types * Accept new baselines * Map on union origin in mapType to better preserve aliases and origins * Remove redundant call * Accept new baselines * Revert back to declared type when branches produce equivalent union * Accept new baselines * Don't include denormal origin types in regular type statistics * Fix issue with unions not being marked primitive-only * Allow new alias to be associated with type alias instantiation * Accept new baselines * Revert "Accept new baselines" This reverts commit4507270cc1
. * Revert "Allow new alias to be associated with type alias instantiation" This reverts commit2c2d06dfe1
.
26 lines
975 B
Plaintext
26 lines
975 B
Plaintext
=== tests/cases/compiler/optionalParameterRetainsNull.ts ===
|
|
interface Bar { bar: number; foo: object | null; }
|
|
>bar : number
|
|
>foo : object | null
|
|
>null : null
|
|
|
|
let a = {
|
|
>a : { test<K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined): void; }
|
|
>{ test<K extends keyof Bar> (a: K, b?: Bar[K] | null) { }} : { test<K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined): void; }
|
|
|
|
test<K extends keyof Bar> (a: K, b?: Bar[K] | null) { }
|
|
>test : <K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined) => void
|
|
>a : K
|
|
>b : Bar[K] | null | undefined
|
|
>null : null
|
|
|
|
};
|
|
a.test("bar", null); // ok, null is assignable to number | null | undefined
|
|
>a.test("bar", null) : void
|
|
>a.test : <K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined) => void
|
|
>a : { test<K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined): void; }
|
|
>test : <K extends keyof Bar>(a: K, b?: Bar[K] | null | undefined) => void
|
|
>"bar" : "bar"
|
|
>null : null
|
|
|