Could not find a declaration file for module '@adobe/css-tools'. '~/my-lib/node_modules/@adobe/css-tools/dist/index.mjs' implicitly has an 'any' type.
There are types at '~/my-lib/node_modules/@adobe/css-tools/dist/types.d.ts', but this result could not be resolved when respecting package.json "exports". The '@adobe/css-tools' library may need to update its package.json or typings.
In the long run, you don’t need "main", "module" and "types" (anywhere!) anymore, as these are superseded by "exports" and modern TypeScript .d.ts resolution. You only have to rename:
I’m not sure how well .d.mts works with older TypeScript versions. There, you may have some success with the package.json property "typesVersions" (but in general it’s better if you don’t use it and only rely on "exports"): https://2ality.com/2021/06/typescript-esm-nodejs.html
The problem
tsconfig.json
:TypeScript code:
Result – error from tsc:
Solutions
Quickest fix – change
package.json
:In the long run, you don’t need
"main"
,"module"
and"types"
(anywhere!) anymore, as these are superseded by"exports"
and modern TypeScript.d.ts
resolution. You only have to rename:Possibly useful
"exports"
: https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports.d.mts
works with older TypeScript versions. There, you may have some success with thepackage.json
property"typesVersions"
(but in general it’s better if you don’t use it and only rely on"exports"
): https://2ality.com/2021/06/typescript-esm-nodejs.html