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 with cjs compile issue #802

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

Yang-33
Copy link
Contributor

@Yang-33 Yang-33 commented Apr 3, 2024

When I tried to run examples with some versions of typescript, some versions(version< 5.3) failed to compile.
The main reason is line-bot-sdk-nodejs's compilerOption is wrong.
To provide dual package, we need to use "module": "ESNext" and "moduleResolution": "Bundler".
We used NodeNext but we should not because this repository will support others not only Node.js.

Otherwise, TypeScript will explicitly write a resolution-mode to the type definition files. (like /// <reference types="node" resolution-mode="require"/>)
Although it should normally be written, there needs to be a way to turn this off when supporting dual packages.

In addition, this change upgrades target from ES2018 to ES2022. Node.js v18 supports ES2022.
ref: https:/microsoft/TypeScript/wiki/Node-Target-Mapping

@Yang-33 Yang-33 marked this pull request as ready for review April 3, 2024 02:12
@@ -17,6 +17,6 @@
"@types/express": "^4.17.17",
"@types/node": "^20.6.3",
"rimraf": "^5.0.1",
"typescript": "^5.4.3"
"typescript": "^5.2.2"
Copy link
Contributor Author

@Yang-33 Yang-33 Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually confirmed that examples can be compiled with five versions from 5.0 to 5.4.

Copy link
Member

@tokuhirom tokuhirom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yang-33 Yang-33 merged commit 20dd1e1 into line:master Apr 5, 2024
3 checks passed
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