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: export types for typescript #78

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

boneskull
Copy link
Collaborator

@boneskull boneskull commented Aug 9, 2023

When TypeScript's module system is set to NodeNext (as recommended), the types cannot be found because they are not present in the export map.

This change fixes the problem by adding the types to the export map. Additionally:

  • it reconfigures the "types" test fixture to:
    • use strict mode
    • module: NodeNext
    • enables lib checking (thus validating env.d.ts)
    • runs tsc --build on npm install
  • updates types.test.js accordingly
  • upgrades typescript to latest
  • fix pkg.test.mjs to correctly reference the updated export map

When TypeScript's module system is set to `NodeNext` (as [recommended](https://www.typescriptlang.org/tsconfig#module)), the types cannot be found because they are not present in the export map.

This change fixes the problem by adding the types to the export map.  Additionally:

- it reconfigures the "types" test fixture to:
    - use `strict` mode
    - `module: NodeNext`
    - enables lib checking (thus validating `env.d.ts`)
    - runs `tsc --build` on `npm install`
- updates `types.test.js` accordingly
- upgrades `typescript` to latest
- fix `pkg.test.mjs` to correctly reference the updated export map
@boneskull
Copy link
Collaborator Author

Note that PR #76 also does some of this.

@boneskull
Copy link
Collaborator Author

Basically, the state of the "types" test was kind of a false positive.

@nzakas
Copy link
Contributor

nzakas commented Aug 15, 2023

Sorry I missed this...not sure why I wasn't getting notifications for this repo.

Thanks. Still learning the ins and outs of types using JavaScript rather than TypeScript.

@nzakas nzakas merged commit 81348f2 into humanwhocodes:main Aug 15, 2023
15 checks passed
@boneskull boneskull deleted the fix-exports-for-types branch August 15, 2023 20:53
@boneskull
Copy link
Collaborator Author

@nzakas No worries. I'm happy to help with this repo if desired.

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.

2 participants