Skip to content

Commit a6e0086

Browse files
committed
fix operator
1 parent de6eadf commit a6e0086

13 files changed

+19
-19
lines changed

tests/baselines/reference/logicalAssignment4(target=es2015).errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tests/cases/conformance/esnext/logicalAssignment/logicalAssignment4.ts(25,21): e
1616
}
1717

1818
function foo4(results: number[] | undefined) {
19-
results ||= [];
19+
results ??= [];
2020
results.push(100);
2121
}
2222

tests/baselines/reference/logicalAssignment4(target=es2015).js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function foo3(results: number[] | undefined) {
1313
}
1414

1515
function foo4(results: number[] | undefined) {
16-
results ||= [];
16+
results ??= [];
1717
results.push(100);
1818
}
1919

@@ -40,7 +40,7 @@ function foo3(results) {
4040
results.push(100);
4141
}
4242
function foo4(results) {
43-
results || (results = []);
43+
results !== null && results !== void 0 ? results : (results = []);
4444
results.push(100);
4545
}
4646
function doSomethingWithAlias(thing) {

tests/baselines/reference/logicalAssignment4(target=es2015).symbols

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function foo4(results: number[] | undefined) {
3636
>foo4 : Symbol(foo4, Decl(logicalAssignment4.ts, 11, 1))
3737
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
3838

39-
results ||= [];
39+
results ??= [];
4040
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
4141

4242
results.push(100);

tests/baselines/reference/logicalAssignment4(target=es2015).types

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function foo4(results: number[] | undefined) {
5050
>foo4 : (results: number[] | undefined) => void
5151
>results : number[] | undefined
5252

53-
results ||= [];
54-
>results ||= [] : number[]
53+
results ??= [];
54+
>results ??= [] : number[]
5555
>results : number[] | undefined
5656
>[] : never[]
5757

tests/baselines/reference/logicalAssignment4(target=es2020).errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tests/cases/conformance/esnext/logicalAssignment/logicalAssignment4.ts(25,21): e
1616
}
1717

1818
function foo4(results: number[] | undefined) {
19-
results ||= [];
19+
results ??= [];
2020
results.push(100);
2121
}
2222

tests/baselines/reference/logicalAssignment4(target=es2020).js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function foo3(results: number[] | undefined) {
1313
}
1414

1515
function foo4(results: number[] | undefined) {
16-
results ||= [];
16+
results ??= [];
1717
results.push(100);
1818
}
1919

@@ -40,7 +40,7 @@ function foo3(results) {
4040
results.push(100);
4141
}
4242
function foo4(results) {
43-
results || (results = []);
43+
results ?? (results = []);
4444
results.push(100);
4545
}
4646
function doSomethingWithAlias(thing) {

tests/baselines/reference/logicalAssignment4(target=es2020).symbols

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function foo4(results: number[] | undefined) {
3636
>foo4 : Symbol(foo4, Decl(logicalAssignment4.ts, 11, 1))
3737
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
3838

39-
results ||= [];
39+
results ??= [];
4040
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
4141

4242
results.push(100);

tests/baselines/reference/logicalAssignment4(target=es2020).types

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function foo4(results: number[] | undefined) {
5050
>foo4 : (results: number[] | undefined) => void
5151
>results : number[] | undefined
5252

53-
results ||= [];
54-
>results ||= [] : number[]
53+
results ??= [];
54+
>results ??= [] : number[]
5555
>results : number[] | undefined
5656
>[] : never[]
5757

tests/baselines/reference/logicalAssignment4(target=esnext).errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tests/cases/conformance/esnext/logicalAssignment/logicalAssignment4.ts(25,21): e
1616
}
1717

1818
function foo4(results: number[] | undefined) {
19-
results ||= [];
19+
results ??= [];
2020
results.push(100);
2121
}
2222

tests/baselines/reference/logicalAssignment4(target=esnext).js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function foo3(results: number[] | undefined) {
1313
}
1414

1515
function foo4(results: number[] | undefined) {
16-
results ||= [];
16+
results ??= [];
1717
results.push(100);
1818
}
1919

@@ -40,7 +40,7 @@ function foo3(results) {
4040
results.push(100);
4141
}
4242
function foo4(results) {
43-
results ||= [];
43+
results ??= [];
4444
results.push(100);
4545
}
4646
function doSomethingWithAlias(thing) {

tests/baselines/reference/logicalAssignment4(target=esnext).symbols

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function foo4(results: number[] | undefined) {
3636
>foo4 : Symbol(foo4, Decl(logicalAssignment4.ts, 11, 1))
3737
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
3838

39-
results ||= [];
39+
results ??= [];
4040
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
4141

4242
results.push(100);

tests/baselines/reference/logicalAssignment4(target=esnext).types

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function foo4(results: number[] | undefined) {
5050
>foo4 : (results: number[] | undefined) => void
5151
>results : number[] | undefined
5252

53-
results ||= [];
54-
>results ||= [] : number[]
53+
results ??= [];
54+
>results ??= [] : number[]
5555
>results : number[] | undefined
5656
>[] : never[]
5757

tests/cases/conformance/esnext/logicalAssignment/logicalAssignment4.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function foo3(results: number[] | undefined) {
1616
}
1717

1818
function foo4(results: number[] | undefined) {
19-
results ||= [];
19+
results ??= [];
2020
results.push(100);
2121
}
2222

0 commit comments

Comments
 (0)