forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexpandoOnAlias.types
More file actions
54 lines (45 loc) · 1.05 KB
/
Copy pathexpandoOnAlias.types
File metadata and controls
54 lines (45 loc) · 1.05 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
=== tests/cases/conformance/salsa/vue.js ===
export class Vue {}
>Vue : Vue
export const config = { x: 0 };
>config : { x: number; }
>{ x: 0 } : { x: number; }
>x : number
>0 : 0
=== tests/cases/conformance/salsa/test.js ===
import { Vue, config } from "./vue";
>Vue : typeof Vue
>config : { x: number; }
// Expando declarations aren't allowed on aliases.
Vue.config = {};
>Vue.config = {} : {}
>Vue.config : any
>Vue : typeof Vue
>config : any
>{} : {}
new Vue();
>new Vue() : Vue
>Vue : typeof Vue
// This is not an expando declaration; it's just a plain property assignment.
config.x = 1;
>config.x = 1 : 1
>config.x : number
>config : { x: number; }
>x : number
>1 : 1
// This is not an expando declaration; it works because non-strict JS allows
// loosey goosey assignment on objects.
config.y = {};
>config.y = {} : {}
>config.y : any
>config : { x: number; }
>y : any
>{} : {}
config.x;
>config.x : number
>config : { x: number; }
>x : number
config.y;
>config.y : any
>config : { x: number; }
>y : any