Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Fix detection of export syntax in declaration file #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gabritto
Copy link
Collaborator

@gabritto gabritto commented Mar 6, 2020

When we inspect a declaration file, we try to decide if it uses export = syntax or named/default ("normal") exports. To do this, we were looking for export constructs in the AST. If we fail to find any export construct, then we stop (with an inferenceError) and don't proceed to infer the type of the module and so we don't perform any further checks.
However, if there's no explicit export keyword or statement, every declaration is considered as exported. So in cases where there's no explicit export, we don't check for instance if the properties exported from the JS match the d.ts.
This PR changes the code to always consider that we're dealing with "normal" exports if we don't find an export =, so we're able to perform further checks for more packages.
The observable result should be that we're able to perform the "JsPropertyNotInDts" check for more packages, which only changes the suggestions provided and doesn't interfere with linting, but it would be nice to test this and future PRs using dtslint-runner before merging and publishing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants