File: destructuringControlFlowNoCrash.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (39 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
=== tests/cases/compiler/destructuringControlFlowNoCrash.ts ===
// legal JS, if nonsensical, which also triggers the issue
const {
  date,
>date : any

} = (inspectedElement: any) => 0;
>(inspectedElement: any) => 0 : (inspectedElement: any) => number
>inspectedElement : any
>0 : 0

date.toISOString();
>date.toISOString() : any
>date.toISOString : any
>date : any
>toISOString : any

// Working flow code
const {
  date2,
>date2 : any

} = (inspectedElement: any).props;
>(inspectedElement: any) : (inspectedElement: any) => any
>inspectedElement : any
> : any
>props : any

date2.toISOString();
>date2.toISOString() : any
>date2.toISOString : any
>date2 : any
>toISOString : any

// It could also be an async function
const { constructor } = async () => {};
>constructor : Function
>async () => {} : () => Promise<void>