Skip to content

Commit a16aaf0

Browse files
committed
add test
1 parent dbf025b commit a16aaf0

5 files changed

Lines changed: 110 additions & 0 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
dependentDestructuredVariablesNoCrash3.ts(3,7): error TS2488: Type 'boolean' must have a '[Symbol.iterator]()' method that returns an iterator.
2+
dependentDestructuredVariablesNoCrash3.ts(3,30): error TS7022: 'string' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
3+
dependentDestructuredVariablesNoCrash3.ts(3,69): error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
4+
dependentDestructuredVariablesNoCrash3.ts(3,86): error TS2448: Block-scoped variable 'string' used before its declaration.
5+
dependentDestructuredVariablesNoCrash3.ts(3,95): error TS1109: Expression expected.
6+
dependentDestructuredVariablesNoCrash3.ts(3,97): error TS2339: Property 'ranges' does not exist on type 'boolean'.
7+
8+
9+
==== dependentDestructuredVariablesNoCrash3.ts (6 errors) ====
10+
// https://github.com/microsoft/TypeScript/issues/63093
11+
12+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3]: boolean = (test as number < string > ).ranges();
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
!!! error TS2488: Type 'boolean' must have a '[Symbol.iterator]()' method that returns an iterator.
15+
~~~~~~
16+
!!! error TS7022: 'string' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
17+
~~~~
18+
!!! error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
19+
~~~~~~
20+
!!! error TS2448: Block-scoped variable 'string' used before its declaration.
21+
!!! related TS2728 dependentDestructuredVariablesNoCrash3.ts:3:30: 'string' is declared here.
22+
~
23+
!!! error TS1109: Expression expected.
24+
~~~~~~
25+
!!! error TS2339: Property 'ranges' does not exist on type 'boolean'.
26+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// [tests/cases/conformance/controlFlow/dependentDestructuredVariablesNoCrash3.ts] ////
2+
3+
//// [dependentDestructuredVariablesNoCrash3.ts]
4+
// https://github.com/microsoft/TypeScript/issues/63093
5+
6+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3]: boolean = (test as number < string > ).ranges();
7+
8+
9+
//// [dependentDestructuredVariablesNoCrash3.js]
10+
"use strict";
11+
// https://github.com/microsoft/TypeScript/issues/63093
12+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3] = (test < string > ).ranges();
13+
14+
15+
//// [dependentDestructuredVariablesNoCrash3.d.ts]
16+
declare const r0Def: any, r0: any, r1Def: any, as: any, string: any, r1: any, r2: any, r3Def: any, r3: any;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [tests/cases/conformance/controlFlow/dependentDestructuredVariablesNoCrash3.ts] ////
2+
3+
=== dependentDestructuredVariablesNoCrash3.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/63093
5+
6+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3]: boolean = (test as number < string > ).ranges();
7+
>r0Def : Symbol(r0Def, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 7))
8+
>r0 : Symbol(r0, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 13))
9+
>r1Def : Symbol(r1Def, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 17))
10+
>as : Symbol(as, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 24))
11+
>string : Symbol(string, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 28))
12+
>r1 : Symbol(r1, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 36))
13+
>r2 : Symbol(r2, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 40))
14+
>r3Def : Symbol(r3Def, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 44))
15+
>r3 : Symbol(r3, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 51))
16+
>string : Symbol(string, Decl(dependentDestructuredVariablesNoCrash3.ts, 2, 28))
17+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//// [tests/cases/conformance/controlFlow/dependentDestructuredVariablesNoCrash3.ts] ////
2+
3+
=== dependentDestructuredVariablesNoCrash3.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/63093
5+
6+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3]: boolean = (test as number < string > ).ranges();
7+
>r0Def : any
8+
> : ^^^
9+
>r0 : any
10+
> : ^^^
11+
>r1Def : any
12+
> : ^^^
13+
>as : any
14+
> : ^^^
15+
>string : any
16+
> : ^^^
17+
>r1 : any
18+
> : ^^^
19+
>r2 : any
20+
> : ^^^
21+
>r3Def : any
22+
> : ^^^
23+
>r3 : any
24+
> : ^^^
25+
>(test as number < string > ).ranges() : any
26+
> : ^^^
27+
>(test as number < string > ).ranges : any
28+
> : ^^^
29+
>(test as number < string > ) : boolean
30+
> : ^^^^^^^
31+
>test as number < string > : boolean
32+
> : ^^^^^^^
33+
>test as number < string : boolean
34+
> : ^^^^^^^
35+
>test as number : number
36+
> : ^^^^^^
37+
>test : any
38+
> : ^^^
39+
>string : any
40+
> : ^^^
41+
> : any
42+
> : ^^^
43+
>ranges : any
44+
> : ^^^
45+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @strict: true
2+
// @declaration: true
3+
4+
// https://github.com/microsoft/TypeScript/issues/63093
5+
6+
const [r0Def, r0, r1Def, as, string, r1, r2, r3Def, r3]: boolean = (test as number < string > ).ranges();

0 commit comments

Comments
 (0)