js
js copied to clipboard
Update typing for node ESM
I added @metaplex-foundation/js
to my project, I'm seeing the following error in Visual Studio Code.
Could not find a declaration file for module '@metaplex-foundation/js'. '/Users/XXX/project/node_modules/@metaplex-foundation/js/dist/esm/index.mjs' implicitly has an 'any' type.
There are types at '/Users/XXX/project/node_modules/@metaplex-foundation/js/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@metaplex-foundation/js' library may need to update its package.json or typings.
I could fix this by doing some tweaks in tsconfig.json
but would be better if it works well out of the box.
Here's my tsconfig.json
:
{
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"compilerOptions": {
// key target params
"target": "ES2020",
"module": "node16",
"moduleResolution": "node16",
// conf
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
// output dir
"outDir": "dist"
},
"ts-node": {
"esm": true
}
}