ba5e86f140
* Propagate 'undefined' instead of the optional type marker at an optional chain boundary * Update src/compiler/types.ts Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
31 lines
930 B
TypeScript
31 lines
930 B
TypeScript
// https://github.com/microsoft/TypeScript/issues/34579
|
|
declare function unbox<T>(box: { value: T | undefined }): T;
|
|
declare const su: string | undefined;
|
|
declare const fnu: (() => number) | undefined;
|
|
declare const osu: { prop: string } | undefined;
|
|
declare const ofnu: { prop: () => number } | undefined;
|
|
|
|
const b1 = { value: su?.length };
|
|
const v1: number = unbox(b1);
|
|
|
|
const b2 = { value: su?.length as number | undefined };
|
|
const v2: number = unbox(b2);
|
|
|
|
const b3: { value: number | undefined } = { value: su?.length };
|
|
const v3: number = unbox(b3);
|
|
|
|
const b4 = { value: fnu?.() };
|
|
const v4: number = unbox(b4);
|
|
|
|
const b5 = { value: su?.["length"] };
|
|
const v5: number = unbox(b5);
|
|
|
|
const b6 = { value: osu?.prop.length };
|
|
const v6: number = unbox(b6);
|
|
|
|
const b7 = { value: osu?.prop["length"] };
|
|
const v7: number = unbox(b7);
|
|
|
|
const b8 = { value: ofnu?.prop() };
|
|
const v8: number = unbox(b8);
|
|
|