Types are not included with ModuleResolution `Node16` or `Bundler` options
Greg-NetDuma opened this issue Β· comments
Attila Greguss commented
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch @tweenjs/tween.js@21.0.0
for the project I'm working on.
Types are not included if moduleResolution
is set to Bundler
, Node16
or more that is using Typescript 5+
Here is the diff that solved my problem:
diff --git a/node_modules/@tweenjs/tween.js/package.json b/node_modules/@tweenjs/tween.js/package.json
index 692ef63..e45ca1c 100644
--- a/node_modules/@tweenjs/tween.js/package.json
+++ b/node_modules/@tweenjs/tween.js/package.json
@@ -8,8 +8,14 @@
"module": "dist/tween.esm.js",
"exports": {
".": {
- "import": "./dist/tween.esm.js",
- "require": "./dist/tween.cjs.js"
+ "import": {
+ "types": "./dist/tween.d.ts",
+ "default": "./dist/tween.esm.js"
+ },
+ "require": {
+ "types": "./dist/tween.d.ts",
+ "default": "./dist/tween.cjs.js"
+ }
}
},
"files": [
This issue body was partially generated by patch-package.
Joe Pea commented
This should be fixed now in v21.1.0 or higher! We added an example TypeScript project in examples/example-projects/plain-typescript-modules/
that shows types working.
Please re-open if still any issues.