File: expandoOnAlias.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 (54 lines) | stat: -rw-r--r-- 1,073 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
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