7c50bccec2
* migrate nullish coalescing commit * add more test case * add branch type check test * add more tests * fix nullish precedence * update public api * add rescan question question token to fix regression * update public api baseline * Added tests that emit for nullish coalescing operator conforming with grammar restrictions when assertions are used. * Fixed emit to hoist temporary variables (they previously went undeclared). Added tests to ensure calls and property accesses are only called once. * use not equal to null * rename factory * add grammar check * fix more cases * Fix handling of nullish coalescing oprator in expando objects. * Fixed classifier to support ?? operator. * update baseline * accept baseline * fix review * update emitter and more testcase * update control flow * make linter happy * update libs * avoid unnecessary assert * fix typooo * Fixes for control-flow analysis
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
// @strict: false
|
|
|
|
declare const a1: 'literal' | undefined | null
|
|
declare const a2: '' | undefined | null
|
|
declare const a3: 1 | undefined | null
|
|
declare const a4: 0 | undefined | null
|
|
declare const a5: true | undefined | null
|
|
declare const a6: false | undefined | null
|
|
declare const a7: unknown | null
|
|
declare const a8: never | null
|
|
declare const a9: any | null
|
|
|
|
|
|
const aa1 = a1 ?? 'whatever'
|
|
const aa2 = a2 ?? 'whatever'
|
|
const aa3 = a3 ?? 'whatever'
|
|
const aa4 = a4 ?? 'whatever'
|
|
const aa5 = a5 ?? 'whatever'
|
|
const aa6 = a6 ?? 'whatever'
|
|
const aa7 = a7 ?? 'whatever'
|
|
const aa8 = a8 ?? 'whatever'
|
|
const aa9 = a9 ?? 'whatever' |