TypeScript/tests/cases/compiler/optionalParameterRetainsNull.ts
Nathan Shively-Sanders e03509affa No subtype reduction in includeFalsyTypes
It's not really needed and caused #13826.
2017-02-07 09:47:10 -08:00

8 lines
232 B
TypeScript

// @strictNullChecks: true
interface Bar { bar: number; foo: object | null; }
let a = {
test<K extends keyof Bar> (a: K, b?: Bar[K] | null) { }
};
a.test("bar", null); // ok, null is assignable to number | null | undefined