fix(no-undefined-types): support strict validation for TS namespaces#1616
Conversation
ca41183 to
ebe9ee0
Compare
ebe9ee0 to
dde69b7
Compare
|
Actually, your original issue mentions use of the |
|
@risantos : Not sure you saw my last comment? |
no-undefined-types): support strict validation for TS namespaces
Sorry, hadn't followed up with notifications since, as I was mostly offline that week.
The included tests already cover that scenario, which was the one I was most concerned with. Specifically these lines, where it would report and now passes as expected: https://github.com/gajus/eslint-plugin-jsdoc/pull/1616/changes#diff-743133df9858e36d2a2f4c8de68b9efd79c4637c23b98871fa579124f597ffaaR2050-R2066 |
dde69b7 to
7fdd59d
Compare
No worries--all good!
Even if the path is covered, I think it would be good to have your |
- Adds `TSModuleDeclaration` to `closedTypes` to enforce strict validation of namespace members. - Recursively finds exported types (`TSTypeAliasDeclaration`, `TSInterfaceDeclaration`) within namespaces. - Adds support for interface properties within namespaces. - Updates tests to verify strict validation of namespace members.
7fdd59d to
b53f7c0
Compare
Good point, so that the docs make it clear that it'll work if it's part of Updated and rebased. ✅ |
|
🎉 This PR is included in version 62.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR updates the
no-undefined-typesrule to support strict validation of TypeScript namespaces. Previously, the rule might have been too permissive or failed to recognize types defined within namespaces in the same file.This became an issue recently with an update that led to
definedTypesmatching a declared namespace on a.d.tsfile starting to report their inner properties/types/interfaces asundefined.An example would be configuring the
no-undefined-typeswith:while having a
.d.tsfile with something such as the following:And then wanting to use
Foobar.FoobarInterface,Foobar.FoobarInterface['foo'], orFoobar.Foobiz.bizas types on JSDoc. The TS LSP would recognize them, but this rule started reporting errors.Changes
TSModuleDeclaration) are now added to theclosedTypesset. This means the rule will strictly validate members accessed on these namespaces (e.g.,MyNamespace.NonExistentTypewill now be reported as undefined).TSTypeAliasDeclaration.TSInterfaceDeclaration(including their properties).ExportNamedDeclarationvariants (likeexport classandexport {}) are properly handled (ignored) without reducing code coverage.