TypeScript/tests/cases/conformance/esnext/logicalAssignment/logicalAssignment5.ts

33 lines
544 B
TypeScript
Raw Normal View History

2020-04-01 10:28:48 +02:00
// @strict: true
// @target: esnext, es2020, es2015
2020-04-01 17:39:38 +02:00
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)
2020-04-01 10:28:48 +02:00
}