Skip to content

Commit

Permalink
fix(valid-types): allow and require types on @extends for TypeScr…
Browse files Browse the repository at this point in the history
…ipt as used in docs (and not name)
  • Loading branch information
brettz9 committed Jul 18, 2021
1 parent 52d7eff commit 6989699
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -20538,6 +20538,12 @@ type ComplicatedType<T, U, V, W, X> = never
* prop: number
* }} MyOptions
*/

/**
* @extends {SomeType}
*/
class quux {}
// Settings: {"jsdoc":{"mode":"typescript"}}
````


6 changes: 3 additions & 3 deletions src/getDefaultTagStructureForMode.js
Expand Up @@ -163,12 +163,12 @@ const getDefaultTagStructureForMode = (mode) => {
['nameContents', 'namepath-referencing'],

// Does not show curly brackets in either the signature or examples
['typeAllowed', isClosureOrPermissive],
['typeAllowed', isTypescriptOrClosure || isPermissive],

['nameRequired', isJsdocOrTypescript],
['nameRequired', isJsdoc],

// "namepath"
['typeOrNameRequired', isClosureOrPermissive],
['typeOrNameRequired', isTypescriptOrClosure || isPermissive],
])],

['external', new Map([
Expand Down
14 changes: 14 additions & 0 deletions test/rules/assertions/validTypes.js
Expand Up @@ -1264,5 +1264,19 @@ export default {
sourceType: 'module',
},
},
{
code: `
/**
* @extends {SomeType}
*/
class quux {}
`,
settings: {
jsdoc: {
mode: 'typescript',
},
},
},
],
};

0 comments on commit 6989699

Please sign in to comment.