swc/crates/swc_ecma_parser/tests/tsc/controlFlowNullishCoalesce.ts
2022-02-04 17:08:38 +09:00

15 lines
223 B
TypeScript

// @strict: true
// assignments in shortcutting rhs
let a: number;
o ?? (a = 1);
a.toString();
// assignment flow
declare const o: { x: number } | undefined;
let x: { x: number } | boolean;
if (x = o ?? true) {
x;
}