Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for Typescript declare structures #1356

Merged
merged 7 commits into from May 23, 2019

Conversation

Projects
None yet
3 participants
@christophercurrie
Copy link
Contributor

commented May 11, 2019

This change improves support various forms used in Typescript declaration files. It's often necessary to change import resolution to prefer '.d.ts' files over '.js' files, but doing so breaks existing import resolution for certain types of UMD modules (React, for example).

This patch has two improvements:

  • It adds support for the export declare function foo() syntax, which wasn't previously recognized
  • It adds support for the export = Namespace syntax for exporting everything in a namespace.

The import/named tests were updated to add both variations as additional test files.

@coveralls

This comment has been minimized.

Copy link

commented May 11, 2019

Coverage Status

Coverage decreased (-0.09%) to 97.844% when pulling aa290bb on christophercurrie:typescript-declare into 1edbbd0 on benmosher:master.

@coveralls

This comment has been minimized.

Copy link

commented May 11, 2019

Coverage Status

Coverage increased (+0.01%) to 97.947% when pulling b52bf3e on christophercurrie:typescript-declare into 1edbbd0 on benmosher:master.

@ljharb ljharb added the typescript label May 12, 2019

@ljharb

ljharb approved these changes May 12, 2019

Copy link
Collaborator

left a comment

Seems reasonable.

Show resolved Hide resolved utils/unambiguous.js Outdated

christophercurrie and others added some commits May 12, 2019

Make groups non-capturing.
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
@christophercurrie

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2019

Thanks. Incorporated your change and fixed the issues with older typescript parsers.

Show resolved Hide resolved src/ExportMap.js Outdated
@christophercurrie

This comment has been minimized.

Copy link
Contributor Author

commented May 13, 2019

I don’t disagree, but I was trying to follow the style of the file. Happy to make a change, just let me know.

@ljharb

This comment has been minimized.

Copy link
Collaborator

commented May 13, 2019

Thanks, it'd be great to improve the readability in this PR :-) it's not a blocker, tho.

christophercurrie added some commits May 13, 2019

@ljharb
Copy link
Collaborator

left a comment

Thanks, much better :-)

Show resolved Hide resolved src/ExportMap.js Outdated
Show resolved Hide resolved src/ExportMap.js Outdated

christophercurrie and others added some commits May 13, 2019

PR feedback
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
PR feedback
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
@christophercurrie

This comment has been minimized.

Copy link
Contributor Author

commented May 13, 2019

Applied.

@ljharb ljharb merged commit 17beb33 into benmosher:master May 23, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.01%) to 97.947%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.