-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
671 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//// [nullishCoalescingOperator1.ts] | ||
declare const a1: string | undefined | null | ||
declare const a2: string | undefined | null | ||
declare const a3: string | undefined | null | ||
declare const a4: string | undefined | null | ||
|
||
declare const b1: number | undefined | null | ||
declare const b2: number | undefined | null | ||
declare const b3: number | undefined | null | ||
declare const b4: number | undefined | null | ||
|
||
declare const c1: boolean | undefined | null | ||
declare const c2: boolean | undefined | null | ||
declare const c3: boolean | undefined | null | ||
declare const c4: boolean | undefined | null | ||
|
||
interface I { a: string } | ||
declare const d1: I | undefined | null | ||
declare const d2: I | undefined | null | ||
declare const d3: I | undefined | null | ||
declare const d4: I | undefined | null | ||
|
||
const aa1 = a1 ?? 'whatever'; | ||
const aa2 = a2 ?? 'whatever'; | ||
const aa3 = a3 ?? 'whatever'; | ||
const aa4 = a4 ?? 'whatever'; | ||
|
||
const bb1 = b1 ?? 1; | ||
const bb2 = b2 ?? 1; | ||
const bb3 = b3 ?? 1; | ||
const bb4 = b4 ?? 1; | ||
|
||
const cc1 = c1 ?? true; | ||
const cc2 = c2 ?? true; | ||
const cc3 = c3 ?? true; | ||
const cc4 = c4 ?? true; | ||
|
||
const dd1 = d1 ?? {b: 1}; | ||
const dd2 = d2 ?? {b: 1}; | ||
const dd3 = d3 ?? {b: 1}; | ||
const dd4 = d4 ?? {b: 1}; | ||
|
||
//// [nullishCoalescingOperator1.js] | ||
"use strict"; | ||
var aa1 = typeof a1 !== "undefined" && a1 !== null ? a1 : 'whatever'; | ||
var aa2 = typeof a2 !== "undefined" && a2 !== null ? a2 : 'whatever'; | ||
var aa3 = typeof a3 !== "undefined" && a3 !== null ? a3 : 'whatever'; | ||
var aa4 = typeof a4 !== "undefined" && a4 !== null ? a4 : 'whatever'; | ||
var bb1 = typeof b1 !== "undefined" && b1 !== null ? b1 : 1; | ||
var bb2 = typeof b2 !== "undefined" && b2 !== null ? b2 : 1; | ||
var bb3 = typeof b3 !== "undefined" && b3 !== null ? b3 : 1; | ||
var bb4 = typeof b4 !== "undefined" && b4 !== null ? b4 : 1; | ||
var cc1 = typeof c1 !== "undefined" && c1 !== null ? c1 : true; | ||
var cc2 = typeof c2 !== "undefined" && c2 !== null ? c2 : true; | ||
var cc3 = typeof c3 !== "undefined" && c3 !== null ? c3 : true; | ||
var cc4 = typeof c4 !== "undefined" && c4 !== null ? c4 : true; | ||
var dd1 = typeof d1 !== "undefined" && d1 !== null ? d1 : { b: 1 }; | ||
var dd2 = typeof d2 !== "undefined" && d2 !== null ? d2 : { b: 1 }; | ||
var dd3 = typeof d3 !== "undefined" && d3 !== null ? d3 : { b: 1 }; | ||
var dd4 = typeof d4 !== "undefined" && d4 !== null ? d4 : { b: 1 }; |
125 changes: 125 additions & 0 deletions
125
tests/baselines/reference/nullishCoalescingOperator1.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
=== tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts === | ||
declare const a1: string | undefined | null | ||
>a1 : Symbol(a1, Decl(nullishCoalescingOperator1.ts, 0, 13)) | ||
|
||
declare const a2: string | undefined | null | ||
>a2 : Symbol(a2, Decl(nullishCoalescingOperator1.ts, 1, 13)) | ||
|
||
declare const a3: string | undefined | null | ||
>a3 : Symbol(a3, Decl(nullishCoalescingOperator1.ts, 2, 13)) | ||
|
||
declare const a4: string | undefined | null | ||
>a4 : Symbol(a4, Decl(nullishCoalescingOperator1.ts, 3, 13)) | ||
|
||
declare const b1: number | undefined | null | ||
>b1 : Symbol(b1, Decl(nullishCoalescingOperator1.ts, 5, 13)) | ||
|
||
declare const b2: number | undefined | null | ||
>b2 : Symbol(b2, Decl(nullishCoalescingOperator1.ts, 6, 13)) | ||
|
||
declare const b3: number | undefined | null | ||
>b3 : Symbol(b3, Decl(nullishCoalescingOperator1.ts, 7, 13)) | ||
|
||
declare const b4: number | undefined | null | ||
>b4 : Symbol(b4, Decl(nullishCoalescingOperator1.ts, 8, 13)) | ||
|
||
declare const c1: boolean | undefined | null | ||
>c1 : Symbol(c1, Decl(nullishCoalescingOperator1.ts, 10, 13)) | ||
|
||
declare const c2: boolean | undefined | null | ||
>c2 : Symbol(c2, Decl(nullishCoalescingOperator1.ts, 11, 13)) | ||
|
||
declare const c3: boolean | undefined | null | ||
>c3 : Symbol(c3, Decl(nullishCoalescingOperator1.ts, 12, 13)) | ||
|
||
declare const c4: boolean | undefined | null | ||
>c4 : Symbol(c4, Decl(nullishCoalescingOperator1.ts, 13, 13)) | ||
|
||
interface I { a: string } | ||
>I : Symbol(I, Decl(nullishCoalescingOperator1.ts, 13, 44)) | ||
>a : Symbol(I.a, Decl(nullishCoalescingOperator1.ts, 15, 13)) | ||
|
||
declare const d1: I | undefined | null | ||
>d1 : Symbol(d1, Decl(nullishCoalescingOperator1.ts, 16, 13)) | ||
>I : Symbol(I, Decl(nullishCoalescingOperator1.ts, 13, 44)) | ||
|
||
declare const d2: I | undefined | null | ||
>d2 : Symbol(d2, Decl(nullishCoalescingOperator1.ts, 17, 13)) | ||
>I : Symbol(I, Decl(nullishCoalescingOperator1.ts, 13, 44)) | ||
|
||
declare const d3: I | undefined | null | ||
>d3 : Symbol(d3, Decl(nullishCoalescingOperator1.ts, 18, 13)) | ||
>I : Symbol(I, Decl(nullishCoalescingOperator1.ts, 13, 44)) | ||
|
||
declare const d4: I | undefined | null | ||
>d4 : Symbol(d4, Decl(nullishCoalescingOperator1.ts, 19, 13)) | ||
>I : Symbol(I, Decl(nullishCoalescingOperator1.ts, 13, 44)) | ||
|
||
const aa1 = a1 ?? 'whatever'; | ||
>aa1 : Symbol(aa1, Decl(nullishCoalescingOperator1.ts, 21, 5)) | ||
>a1 : Symbol(a1, Decl(nullishCoalescingOperator1.ts, 0, 13)) | ||
|
||
const aa2 = a2 ?? 'whatever'; | ||
>aa2 : Symbol(aa2, Decl(nullishCoalescingOperator1.ts, 22, 5)) | ||
>a2 : Symbol(a2, Decl(nullishCoalescingOperator1.ts, 1, 13)) | ||
|
||
const aa3 = a3 ?? 'whatever'; | ||
>aa3 : Symbol(aa3, Decl(nullishCoalescingOperator1.ts, 23, 5)) | ||
>a3 : Symbol(a3, Decl(nullishCoalescingOperator1.ts, 2, 13)) | ||
|
||
const aa4 = a4 ?? 'whatever'; | ||
>aa4 : Symbol(aa4, Decl(nullishCoalescingOperator1.ts, 24, 5)) | ||
>a4 : Symbol(a4, Decl(nullishCoalescingOperator1.ts, 3, 13)) | ||
|
||
const bb1 = b1 ?? 1; | ||
>bb1 : Symbol(bb1, Decl(nullishCoalescingOperator1.ts, 26, 5)) | ||
>b1 : Symbol(b1, Decl(nullishCoalescingOperator1.ts, 5, 13)) | ||
|
||
const bb2 = b2 ?? 1; | ||
>bb2 : Symbol(bb2, Decl(nullishCoalescingOperator1.ts, 27, 5)) | ||
>b2 : Symbol(b2, Decl(nullishCoalescingOperator1.ts, 6, 13)) | ||
|
||
const bb3 = b3 ?? 1; | ||
>bb3 : Symbol(bb3, Decl(nullishCoalescingOperator1.ts, 28, 5)) | ||
>b3 : Symbol(b3, Decl(nullishCoalescingOperator1.ts, 7, 13)) | ||
|
||
const bb4 = b4 ?? 1; | ||
>bb4 : Symbol(bb4, Decl(nullishCoalescingOperator1.ts, 29, 5)) | ||
>b4 : Symbol(b4, Decl(nullishCoalescingOperator1.ts, 8, 13)) | ||
|
||
const cc1 = c1 ?? true; | ||
>cc1 : Symbol(cc1, Decl(nullishCoalescingOperator1.ts, 31, 5)) | ||
>c1 : Symbol(c1, Decl(nullishCoalescingOperator1.ts, 10, 13)) | ||
|
||
const cc2 = c2 ?? true; | ||
>cc2 : Symbol(cc2, Decl(nullishCoalescingOperator1.ts, 32, 5)) | ||
>c2 : Symbol(c2, Decl(nullishCoalescingOperator1.ts, 11, 13)) | ||
|
||
const cc3 = c3 ?? true; | ||
>cc3 : Symbol(cc3, Decl(nullishCoalescingOperator1.ts, 33, 5)) | ||
>c3 : Symbol(c3, Decl(nullishCoalescingOperator1.ts, 12, 13)) | ||
|
||
const cc4 = c4 ?? true; | ||
>cc4 : Symbol(cc4, Decl(nullishCoalescingOperator1.ts, 34, 5)) | ||
>c4 : Symbol(c4, Decl(nullishCoalescingOperator1.ts, 13, 13)) | ||
|
||
const dd1 = d1 ?? {b: 1}; | ||
>dd1 : Symbol(dd1, Decl(nullishCoalescingOperator1.ts, 36, 5)) | ||
>d1 : Symbol(d1, Decl(nullishCoalescingOperator1.ts, 16, 13)) | ||
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 36, 19)) | ||
|
||
const dd2 = d2 ?? {b: 1}; | ||
>dd2 : Symbol(dd2, Decl(nullishCoalescingOperator1.ts, 37, 5)) | ||
>d2 : Symbol(d2, Decl(nullishCoalescingOperator1.ts, 17, 13)) | ||
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 37, 19)) | ||
|
||
const dd3 = d3 ?? {b: 1}; | ||
>dd3 : Symbol(dd3, Decl(nullishCoalescingOperator1.ts, 38, 5)) | ||
>d3 : Symbol(d3, Decl(nullishCoalescingOperator1.ts, 18, 13)) | ||
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 38, 19)) | ||
|
||
const dd4 = d4 ?? {b: 1}; | ||
>dd4 : Symbol(dd4, Decl(nullishCoalescingOperator1.ts, 39, 5)) | ||
>d4 : Symbol(d4, Decl(nullishCoalescingOperator1.ts, 19, 13)) | ||
>b : Symbol(b, Decl(nullishCoalescingOperator1.ts, 39, 19)) | ||
|
Oops, something went wrong.