Package's name
Which package from the monorepo is it for?
edit-package-json
Describe the bug
A clear and concise description of what the bug is.
Typescript cannot find the types for edit-package-json when using "moduleResolution": "Node16", on typescript v4.7.3
To Reproduce
Steps to reproduce the behavior:
tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "Node16",
}
}
Sample file:
import { del, set } from 'edit-package-json';
Error message:
error TS7016: Could not find a declaration file for module 'edit-package-json'. 'node_modules/edit-package-json/dist/edit-package-json.esm.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/edit-package-json` if it exists or add a new declaration (.d.ts) file containing `declare module 'edit-package-json';`
import { del, set } from 'edit-package-json';
Expected behavior
Typescript is able to find the type definitions.
Additional context
Typescript 4.7.3 added support for ESM modules in node.js, including the "exports" keyword in package.json. The relevant portion of package.json for edit-package-json is as follows:
"exports": {
"script": "./dist/edit-package-json.umd.js",
"default": "./dist/edit-package-json.esm.js"
},
"types": "types/index.d.ts",
As written, Typescript 4.7.3 is looking for ./dist/edit-package-json.esm.d.ts, but that files does not exist. Either add a "types" within the "exports" section pointing to the right file, or change the build process to output a definition file in the expected location with the expected name. Typescript 4.7.3 exports reference
Package's name
Which package from the monorepo is it for?
edit-package-json
Describe the bug
A clear and concise description of what the bug is.
Typescript cannot find the types for
edit-package-jsonwhen using "moduleResolution": "Node16", on typescript v4.7.3To Reproduce
Steps to reproduce the behavior:
tsconfig.json
Sample file:
Error message:
Expected behavior
Typescript is able to find the type definitions.
Additional context
Typescript 4.7.3 added support for ESM modules in node.js, including the "exports" keyword in package.json. The relevant portion of package.json for edit-package-json is as follows:
As written, Typescript 4.7.3 is looking for
./dist/edit-package-json.esm.d.ts, but that files does not exist. Either add a "types" within the "exports" section pointing to the right file, or change the build process to output a definition file in the expected location with the expected name. Typescript 4.7.3 exports reference