1
1
export default {
2
2
invalid : [
3
3
{
4
- code : 'type FooType = { a: number, b: string, a: number }' ,
4
+ code : 'type f = { a: number, b: string, a: number }' ,
5
+ errors : [ { message : 'Duplicate property.' } ]
6
+ } ,
7
+ {
8
+ code : 'type f = { a: number, b: string, a: string }' ,
9
+ errors : [ { message : 'Duplicate property.' } ]
10
+ } ,
11
+ {
12
+ code : 'type f = { get(key: "a"): string, get(key: "a"): string }' ,
13
+ errors : [ { message : 'Duplicate property.' } ]
14
+ } ,
15
+ {
16
+ code : 'type f = { get(key: 1): string, get(key: 1): string }' ,
17
+ errors : [ { message : 'Duplicate property.' } ]
18
+ } ,
19
+ {
20
+ code : 'type f = { get(key: 1.1): string, get(key: 1.1): string }' ,
21
+ errors : [ { message : 'Duplicate property.' } ]
22
+ } ,
23
+ {
24
+ code : 'type f = { get(key: true): string, get(key: true): string }' ,
5
25
errors : [ { message : 'Duplicate property.' } ]
6
26
} ,
7
27
{
8
- code : 'type FooType = { a: number, b: string, a: string }' ,
28
+ code : 'type f = { get(key: {a: 1}): string, get(key: {a: 1}):string }' ,
29
+ errors : [ { message : 'Duplicate property.' } ]
30
+ } ,
31
+ {
32
+ code : 'var a = "a"; type f = { get(key: a): string, get(key: a): string }' ,
33
+ errors : [ { message : 'Duplicate property.' } ]
34
+ } ,
35
+ {
36
+ code : 'var b = 1; type f = { get(key: b): string, get(key: b): string }' ,
37
+ errors : [ { message : 'Duplicate property.' } ]
38
+ } ,
39
+ {
40
+ code : 'var c = true; type f = { get(key: c): string, get(key: c): string }' ,
41
+ errors : [ { message : 'Duplicate property.' } ]
42
+ } ,
43
+ {
44
+ code : 'var d = {}; type f = { get(key: d): string, get(key: d): string }' ,
45
+ errors : [ { message : 'Duplicate property.' } ]
46
+ } ,
47
+ {
48
+ code : 'var e = []; type f = { get(key: e): string, get(key: e): string }' ,
49
+ errors : [ { message : 'Duplicate property.' } ]
50
+ } ,
51
+ {
52
+ code : 'var e = [1, "a"]; type f = { get(key: e): string, get(key: e): string }' ,
53
+ errors : [ { message : 'Duplicate property.' } ]
54
+ } ,
55
+ {
56
+ code : 'function fn() {}; type f = { get(key: fn): string, get(key: fn): string }' ,
9
57
errors : [ { message : 'Duplicate property.' } ]
10
58
}
11
59
] ,
@@ -20,6 +68,45 @@ export default {
20
68
onlyFilesWithFlowAnnotation : true
21
69
}
22
70
}
71
+ } ,
72
+ {
73
+ code : 'type f = { get(key: "a"): string, get(key: "b"): string }'
74
+ } ,
75
+ {
76
+ code : 'type f = { get(key: 1): string, get(key: 2): string }'
77
+ } ,
78
+ {
79
+ code : 'type f = { get(key: 1.1): string, get(key: 1.2): string }'
80
+ } ,
81
+ {
82
+ code : 'type f = { get(key: true): string, get(key: false): string }'
83
+ } ,
84
+ {
85
+ code : 'type f = { get(key: ["a", 1]): string, get(key: ["a", 2]): string }'
86
+ } ,
87
+ {
88
+ code : 'type f = { get(key: ["a", ["b", 1]]): string, get(key: ["a", ["b", 2]]): string }'
89
+ } ,
90
+ {
91
+ code : 'type f = { a: number, b: string, c: number }'
92
+ } ,
93
+ {
94
+ code : 'type f = { get(key: "a"): string, get(key: "b"): string }'
95
+ } ,
96
+ {
97
+ code : 'type f = { get(key: "a"): string, get(key: "a", key2: "b"): string }'
98
+ } ,
99
+ {
100
+ code : 'type f = { get(key: "a"): string, get(key: 1): string }'
101
+ } ,
102
+ {
103
+ code : 'type f = { get(key: { a: 1 }): string, get(key: { a: 2 }): string}'
104
+ } ,
105
+ {
106
+ code : 'var a = {}; var b = {}; type f = { get(key: a): string, get(key: b): string }'
107
+ } ,
108
+ {
109
+ code : 'var a = 1; var b = 1; type f = { get(key: a): string, get(key: b): string }'
23
110
}
24
111
]
25
112
} ;
0 commit comments