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

Fix TypeScript .d.ts files #119

Merged
merged 1 commit into from
Sep 9, 2023
Merged

Fix TypeScript .d.ts files #119

merged 1 commit into from
Sep 9, 2023

Conversation

lydell
Copy link
Member

@lydell lydell commented Sep 9, 2023

export default is apparently wrong for what we’re doing. export = is the correct one. Source: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/4706e9a84892be17888bb01a4d85c0bfed3230c2/docs/problems/FalseExportDefault.md

I’ve tested this with both require and import in both TS and JS files, with different "module" and "moduleResolution" settings, and it seems to work perfectly.

With this commit, it is now possible to do:

const elmToolingCli = require("elm-tooling")

in an @ts-checked JS file without errors – no errors at compile time, and no errors at runtime.

`export default` is apparently wrong for what we’re doing. `export =` is
the correct one. Source: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/4706e9a84892be17888bb01a4d85c0bfed3230c2/docs/problems/FalseExportDefault.md

I’ve tested this with both `require` and `import` in both TS and JS
files, with different `"module"` and `"moduleResolution"` settings, and
it seems to work perfectly.

With this commit, it is now possible to do:

    const elmToolingCli = require("elm-tooling")

in an `@ts-check`ed JS file without errors – no errors at compile time, and no
errors at runtime.
@lydell lydell merged commit fad0025 into main Sep 9, 2023
18 checks passed
@lydell lydell deleted the fix-types branch September 9, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant