Skip to content

Commit 904e02f

Browse files
committed
test(check-types): add cases for gajus#709
1 parent 6524c31 commit 904e02f

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5447,6 +5447,15 @@ function quux (foo) {
54475447
}
54485448
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object"}}}
54495449
// Message: Invalid JSDoc @param "foo" type "Object"; prefer: "object".
5450+
5451+
/**
5452+
* @param {object.<string>} foo
5453+
*/
5454+
function quux (foo) {
5455+
5456+
}
5457+
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object.<>":"Object"}}}
5458+
// Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
54505459
````
54515460

54525461
The following patterns are not considered problems:
@@ -5734,6 +5743,14 @@ function b () {}
57345743
function quux (foo) {
57355744

57365745
}
5746+
5747+
/**
5748+
* @param {Object.<string>} foo
5749+
*/
5750+
function quux (foo) {
5751+
5752+
}
5753+
// Settings: {"jsdoc":{"mode":"typescript"}}
57375754
````
57385755

57395756

test/rules/assertions/checkTypes.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,38 @@ export default {
21612161
},
21622162
},
21632163
},
2164+
{
2165+
code: `
2166+
/**
2167+
* @param {object.<string>} foo
2168+
*/
2169+
function quux (foo) {
2170+
2171+
}
2172+
`,
2173+
errors: [
2174+
{
2175+
line: 3,
2176+
message: 'Invalid JSDoc @param "foo" type "object"; prefer: "Object".',
2177+
},
2178+
],
2179+
output: `
2180+
/**
2181+
* @param {Object.<string>} foo
2182+
*/
2183+
function quux (foo) {
2184+
2185+
}
2186+
`,
2187+
settings: {
2188+
jsdoc: {
2189+
mode: 'typescript',
2190+
preferredTypes: {
2191+
'object.<>': 'Object',
2192+
},
2193+
},
2194+
},
2195+
},
21642196
],
21652197
valid: [
21662198
{
@@ -2757,5 +2789,20 @@ export default {
27572789
}
27582790
`,
27592791
},
2792+
{
2793+
code: `
2794+
/**
2795+
* @param {Object.<string>} foo
2796+
*/
2797+
function quux (foo) {
2798+
2799+
}
2800+
`,
2801+
settings: {
2802+
jsdoc: {
2803+
mode: 'typescript',
2804+
},
2805+
},
2806+
},
27602807
],
27612808
};

0 commit comments

Comments
 (0)