forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an extra test for
as const satisfies
with a mutable array (micr…
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/typeSatisfaction_asConstArrays.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,13 @@ | ||
//// [tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction_asConstArrays.ts] //// | ||
|
||
=== typeSatisfaction_asConstArrays.ts === | ||
// with readonly array | ||
const arr1 = [1, 2, 3] as const satisfies readonly unknown[] | ||
>arr1 : Symbol(arr1, Decl(typeSatisfaction_asConstArrays.ts, 1, 5)) | ||
>const : Symbol(const) | ||
|
||
// with mutable array | ||
const arr2 = [1, 2, 3] as const satisfies unknown[] | ||
>arr2 : Symbol(arr2, Decl(typeSatisfaction_asConstArrays.ts, 4, 5)) | ||
>const : Symbol(const) | ||
|
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/typeSatisfaction_asConstArrays.types
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,23 @@ | ||
//// [tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction_asConstArrays.ts] //// | ||
|
||
=== typeSatisfaction_asConstArrays.ts === | ||
// with readonly array | ||
const arr1 = [1, 2, 3] as const satisfies readonly unknown[] | ||
>arr1 : readonly [1, 2, 3] | ||
>[1, 2, 3] as const satisfies readonly unknown[] : readonly [1, 2, 3] | ||
>[1, 2, 3] as const : readonly [1, 2, 3] | ||
>[1, 2, 3] : readonly [1, 2, 3] | ||
>1 : 1 | ||
>2 : 2 | ||
>3 : 3 | ||
|
||
// with mutable array | ||
const arr2 = [1, 2, 3] as const satisfies unknown[] | ||
>arr2 : [1, 2, 3] | ||
>[1, 2, 3] as const satisfies unknown[] : [1, 2, 3] | ||
>[1, 2, 3] as const : [1, 2, 3] | ||
>[1, 2, 3] : [1, 2, 3] | ||
>1 : 1 | ||
>2 : 2 | ||
>3 : 3 | ||
|
8 changes: 8 additions & 0 deletions
8
tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction_asConstArrays.ts
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,8 @@ | ||
// @strict: true | ||
// @noEmit: true | ||
|
||
// with readonly array | ||
const arr1 = [1, 2, 3] as const satisfies readonly unknown[] | ||
|
||
// with mutable array | ||
const arr2 = [1, 2, 3] as const satisfies unknown[] |