Skip to content

Commit 44acbe9

Browse files
l1bbcsgbrettz9
authored andcommitted
Add invalid test cases for generic types
1 parent 95aba28 commit 44acbe9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/rules/assertions/noUndefinedTypes.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,51 @@ export default {
154154
}
155155
}
156156
}
157+
},
158+
{
159+
code: `
160+
class Foo {
161+
/**
162+
* @return {TEMPLATE_TYPE}
163+
*/
164+
bar () {
165+
}
166+
}
167+
`,
168+
errors: [
169+
{
170+
line: 4,
171+
message: 'The type \'TEMPLATE_TYPE\' is undefined.'
172+
}
173+
]
174+
},
175+
{
176+
code: `
177+
class Foo {
178+
/**
179+
* @return {TEMPLATE_TYPE}
180+
*/
181+
invalidTemplateReference () {
182+
}
183+
}
184+
185+
/**
186+
* @template TEMPLATE_TYPE
187+
*/
188+
class Bar {
189+
/**
190+
* @return {TEMPLATE_TYPE}
191+
*/
192+
validTemplateReference () {
193+
}
194+
}
195+
`,
196+
errors: [
197+
{
198+
line: 4,
199+
message: 'The type \'TEMPLATE_TYPE\' is undefined.'
200+
}
201+
]
157202
}
158203
],
159204
valid: [

0 commit comments

Comments
 (0)