mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 21:21:31 +03:00
33 lines
552 B
TypeScript
33 lines
552 B
TypeScript
// @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)
|
|
}
|