mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 11:42:13 +03:00
17 lines
401 B
TypeScript
17 lines
401 B
TypeScript
// @strict: true
|
|
// @target: esnext, es2021, es2020, es2015
|
|
|
|
declare const bar: { value?: number[] } | undefined
|
|
|
|
function foo1(results: number[] | undefined) {
|
|
(results ||= bar?.value ?? []).push(100);
|
|
}
|
|
|
|
function foo2(results: number[] | undefined) {
|
|
(results ??= bar?.value ?? []).push(100);
|
|
}
|
|
|
|
function foo3(results: number[] | undefined) {
|
|
(results &&= bar?.value ?? []).push(100);
|
|
}
|