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

Add 'types' to package.json#exports because newer typescript versions ignore the package.json#types entry when package.json#exports is present #1137

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

NullVoxPopuli
Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli commented Sep 12, 2023

Resolves:

Could not find a declaration file for module 'ember-qunit'. 
'<repo>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-qunit/dist/index.js' 
implicitly has an 'any' type.

There are types at '<repo>/node_modules/ember-qunit/types/index.d.ts', 
but this result could not be resolved when respecting package.json "exports". 

The 'ember-qunit' library may need to update its package.json or typings.

Tested locally via pnpm patch, with this patchfile:

diff --git a/package.json b/package.json
index 9a4a8bb4463d899cc7122145f5dbef54b0e85b71..751d5a1b7aca8ddffab8d8515a70994a5d4cf1a3 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,10 @@
     "Steve Calvert"
   ],
   "exports": {
-    ".": "./dist/index.js",
+    ".": {
+      "types": "./types/index.d.ts",
+      "default": "./dist/index.js"
+    },
     "./*": "./dist/*.js",
     "./addon-main.js": "./addon-main.cjs"
   },

Passing ts-matrix ensures no regressions.

… ignore the package.json#types entry when package.json#exports is present
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review September 12, 2023 22:21
@kategengler kategengler merged commit e50529c into emberjs:main Sep 12, 2023
@NullVoxPopuli NullVoxPopuli deleted the fix-types branch September 12, 2023 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants