swc/crates/swc_ecma_parser/tests/tsc/logicalAssignment5.ts

33 lines
552 B
TypeScript
Raw Normal View History

// @strict: true
// @target: esnext, es2021, es2020, es2015
function foo1 (f?: (a: number) => void) {
f ??= (a => a)
f(42)
}
function foo2 (f?: (a: number) => void) {
f ||= (a => a)
f(42)
}
function foo3 (f?: (a: number) => void) {
f &&= (a => a)
f(42)
}
function bar1 (f?: (a: number) => void) {
f ??= (f.toString(), (a => a))
f(42)
}
function bar2 (f?: (a: number) => void) {
f ||= (f.toString(), (a => a))
f(42)
}
function bar3 (f?: (a: number) => void) {
f &&= (f.toString(), (a => a))
f(42)
}