Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an extra test for as const satisfies with a mutable array #55522

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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[]
Loading