Skip to content

Commit c468960

Browse files
authored
Add test for old completion bug from prop of constraint (#54959)
1 parent 3b6e35c commit c468960

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
=== /tests/cases/fourslash/completionPropertyFromConstraint.ts ===
2+
// interface Styles {
3+
// alignContent: string | null;
4+
// alignItems: string | null;
5+
// alignmentBaseline: string | null;
6+
// // etc..
7+
// [key: string]: any
8+
// }
9+
//
10+
// interface StyleMap {
11+
// [name: string]: Partial<Styles>
12+
// }
13+
//
14+
// declare function createStyles<T extends StyleMap>(styles: T): T
15+
//
16+
// createStyles({
17+
// x: {
18+
// '': ''
19+
//
20+
// | ----------------------------------------------------------------------
21+
// | (property) alignContent?: string
22+
// | (property) alignItems?: string
23+
// | (property) alignmentBaseline?: string
24+
// | ----------------------------------------------------------------------
25+
// }
26+
// });
27+
28+
[
29+
{
30+
"marker": {
31+
"fileName": "/tests/cases/fourslash/completionPropertyFromConstraint.ts",
32+
"position": 300,
33+
"name": "1"
34+
},
35+
"item": {
36+
"isGlobalCompletion": false,
37+
"isMemberCompletion": true,
38+
"isNewIdentifierLocation": false,
39+
"optionalReplacementSpan": {
40+
"start": 300,
41+
"length": 0
42+
},
43+
"entries": [
44+
{
45+
"name": "alignContent",
46+
"kind": "property",
47+
"kindModifiers": "optional",
48+
"sortText": "11",
49+
"replacementSpan": {
50+
"start": 300,
51+
"length": 0
52+
},
53+
"displayParts": [
54+
{
55+
"text": "(",
56+
"kind": "punctuation"
57+
},
58+
{
59+
"text": "property",
60+
"kind": "text"
61+
},
62+
{
63+
"text": ")",
64+
"kind": "punctuation"
65+
},
66+
{
67+
"text": " ",
68+
"kind": "space"
69+
},
70+
{
71+
"text": "alignContent",
72+
"kind": "propertyName"
73+
},
74+
{
75+
"text": "?",
76+
"kind": "punctuation"
77+
},
78+
{
79+
"text": ":",
80+
"kind": "punctuation"
81+
},
82+
{
83+
"text": " ",
84+
"kind": "space"
85+
},
86+
{
87+
"text": "string",
88+
"kind": "keyword"
89+
}
90+
],
91+
"documentation": []
92+
},
93+
{
94+
"name": "alignItems",
95+
"kind": "property",
96+
"kindModifiers": "optional",
97+
"sortText": "11",
98+
"replacementSpan": {
99+
"start": 300,
100+
"length": 0
101+
},
102+
"displayParts": [
103+
{
104+
"text": "(",
105+
"kind": "punctuation"
106+
},
107+
{
108+
"text": "property",
109+
"kind": "text"
110+
},
111+
{
112+
"text": ")",
113+
"kind": "punctuation"
114+
},
115+
{
116+
"text": " ",
117+
"kind": "space"
118+
},
119+
{
120+
"text": "alignItems",
121+
"kind": "propertyName"
122+
},
123+
{
124+
"text": "?",
125+
"kind": "punctuation"
126+
},
127+
{
128+
"text": ":",
129+
"kind": "punctuation"
130+
},
131+
{
132+
"text": " ",
133+
"kind": "space"
134+
},
135+
{
136+
"text": "string",
137+
"kind": "keyword"
138+
}
139+
],
140+
"documentation": []
141+
},
142+
{
143+
"name": "alignmentBaseline",
144+
"kind": "property",
145+
"kindModifiers": "optional",
146+
"sortText": "11",
147+
"replacementSpan": {
148+
"start": 300,
149+
"length": 0
150+
},
151+
"displayParts": [
152+
{
153+
"text": "(",
154+
"kind": "punctuation"
155+
},
156+
{
157+
"text": "property",
158+
"kind": "text"
159+
},
160+
{
161+
"text": ")",
162+
"kind": "punctuation"
163+
},
164+
{
165+
"text": " ",
166+
"kind": "space"
167+
},
168+
{
169+
"text": "alignmentBaseline",
170+
"kind": "propertyName"
171+
},
172+
{
173+
"text": "?",
174+
"kind": "punctuation"
175+
},
176+
{
177+
"text": ":",
178+
"kind": "punctuation"
179+
},
180+
{
181+
"text": " ",
182+
"kind": "space"
183+
},
184+
{
185+
"text": "string",
186+
"kind": "keyword"
187+
}
188+
],
189+
"documentation": []
190+
}
191+
]
192+
}
193+
}
194+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// interface Styles {
4+
//// alignContent: string | null;
5+
//// alignItems: string | null;
6+
//// alignmentBaseline: string | null;
7+
//// // etc..
8+
//// [key: string]: any
9+
//// }
10+
////
11+
//// interface StyleMap {
12+
//// [name: string]: Partial<Styles>
13+
//// }
14+
////
15+
//// declare function createStyles<T extends StyleMap>(styles: T): T
16+
////
17+
//// createStyles({
18+
//// x: {
19+
//// '/*1*/': ''
20+
//// }
21+
//// });
22+
23+
verify.baselineCompletions();

0 commit comments

Comments
 (0)