Skip to content

Commit

Permalink
Add an extra test for as const satisfies with a mutable array (micr…
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored and snovader committed Sep 23, 2023
1 parent 0ab8889 commit a7ba139
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/baselines/reference/typeSatisfaction_asConstArrays.symbols
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 tests/baselines/reference/typeSatisfaction_asConstArrays.types
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

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[]

0 comments on commit a7ba139

Please sign in to comment.