-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Evaluate popular packages that have exports
fields set but may not be Node ESM-ready for TypeScript
#47792
Comments
all-the-package-names seems to be updated daily. Not sure why we thought the list was outdated before? |
I've been using TypeScript v4.6-dev.x and the It makes it harder to evaluate as you are working what packages are ESM ready and to experiment with possible fixes for a PR by hacking them in An example of a package this happens with is With this {
"typescript.disableAutomaticTypeAcquisition": true,
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": "node_modules/typescript/lib"
} And this {
"compilerOptions": {
"module": "node12",
"noEmit": true,
"strict": true
},
"typeAcquisition": {
"enable": false
}
} And this package {
"typescript": "^4.6.0-dev.20220207"
} And this package {
"types": "tsc -p jsconfig.json",
} If you run:
In // @ts-check
/** @typedef {import("playwright").chromium} A */
/** @typedef {import("playwright").Page} B */ In import { chromium } from "playwright";
import type { Page } from "playwright"; In the VS Code editor the imported But via The |
@DanielRosenwasser Would you be so kind and help me find the correct way to do? "exports": {
".": {
"import": "./index.mjs",
"require": "./index.js",
"types": "./index.d.ts"
},
"./cli": "./cli.js",
"./package.json": "./package.json",
}, Assuming there is a |
That is right, assuming a single |
It wasn't published for two years, then the first publish was 10 hours before your comment. Coincidence? ..Probably. Edit: looking at nice-registry/all-the-package-names#26, I see that it now depends on all-the-package-repos, which now, surprisingly, includes all packages, even ones without repos. But it's not sorted by dependent count anymore. Edit 2 (from May): all-the-package-names stopped updating from mid-March to May. Check to see if it's current before using it. |
Thank you for sending those PRs! |
This just bit vue-router. |
The
exports
field inpackage.json
- nobody knows how to configure it, which probably means that a negative number of people know how to configure it for TypeScript.Anyway, a very good way to ensure that 99% of users have no issues with consuming a Node ESM package is to do a sweep of the npm registry to find the most popular packages that have an
exports
field and atypes
field set and validate that they have correctly configured their types.The steps include
types
field set or have a corresponding@types
package.@types
package) are configured correctly.Last time I tried to do this with
all-the-package-names
, people told me the list might be too outdated, but the list might serve as a decent guide anyway:Click here to see the list.
Self-Typed: 18
Packages with
@types
At-Typed: 121
The text was updated successfully, but these errors were encountered: