Skip to content

Commit 0682323

Browse files
committed
Add extra test case
1 parent 3c846b4 commit 0682323

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [tests/cases/compiler/strictOptionalPropertiesOmittedExpressions1.ts] ////
2+
3+
=== strictOptionalPropertiesOmittedExpressions1.ts ===
4+
function test1(arg: [number, undefined, string]) {}
5+
>test1 : Symbol(test1, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 0, 0))
6+
>arg : Symbol(arg, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 0, 15))
7+
8+
test1([10, , "foo"]); // ok
9+
>test1 : Symbol(test1, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 0, 0))
10+
11+
const test2 = ["foo", ,] as const;
12+
>test2 : Symbol(test2, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 3, 5))
13+
>const : Symbol(const)
14+
15+
const length2 = test2.length; // 2
16+
>length2 : Symbol(length2, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 4, 5))
17+
>test2.length : Symbol(length)
18+
>test2 : Symbol(test2, Decl(strictOptionalPropertiesOmittedExpressions1.ts, 3, 5))
19+
>length : Symbol(length)
20+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//// [tests/cases/compiler/strictOptionalPropertiesOmittedExpressions1.ts] ////
2+
3+
=== strictOptionalPropertiesOmittedExpressions1.ts ===
4+
function test1(arg: [number, undefined, string]) {}
5+
>test1 : (arg: [number, undefined, string]) => void
6+
>arg : [number, undefined, string]
7+
8+
test1([10, , "foo"]); // ok
9+
>test1([10, , "foo"]) : void
10+
>test1 : (arg: [number, undefined, string]) => void
11+
>[10, , "foo"] : [number, undefined, string]
12+
>10 : 10
13+
> : undefined
14+
>"foo" : "foo"
15+
16+
const test2 = ["foo", ,] as const;
17+
>test2 : readonly ["foo", undefined]
18+
>["foo", ,] as const : readonly ["foo", undefined]
19+
>["foo", ,] : readonly ["foo", undefined]
20+
>"foo" : "foo"
21+
> : undefined
22+
23+
const length2 = test2.length; // 2
24+
>length2 : 2
25+
>test2.length : 2
26+
>test2 : readonly ["foo", undefined]
27+
>length : 2
28+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @strict: true
2+
// @exactOptionalPropertyTypes: true
3+
// @noEmit: true
4+
5+
function test1(arg: [number, undefined, string]) {}
6+
test1([10, , "foo"]); // ok
7+
8+
const test2 = ["foo", ,] as const;
9+
const length2 = test2.length; // 2

0 commit comments

Comments
 (0)