Closed maplesteve closed 8 months ago
could you share your tsconfig please?
could you share your tsconfig please?
Sure.
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["ES2022"],
"target": "ES2022",
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"paths": {
"~/*": ["./src/*"],
"@/*": ["./*"]
},
"sourceMap": true,
"strict": true,
"useDefineForClassFields": true
},
"include": ["./src", "./test/"]
}
i just realized, your typescript compiler still trying to import [path]/node_modules/mimetext/dist/node/mimetext.cjs
from old path. the dist
folder is not being used anymore (as of v3.0.17). its probably a caching issue with your typescript compiler or something else related your end. try to resolve it please, i don't know what to suggest without knowing your setup. i will be here to further assist in any case.
I'm sorry. The error message was from v3.0.17. Here's the one produced with v.3.0.20:
Could not find a declaration file for module 'mimetext'. '[path]/node_modules/mimetext/build/entrypoints/node.cjs' implicitly has an 'any' type. Try
npm i --save-dev @types/mimetext
if it exists or add a new declaration (.d.ts) file containingdeclare module 'mimetext';
ts(7016)
okay :) which version of node.js and npm are you using? the types are defined in the same place where node.cjs
is and your project should be able to find them by mimetext's package.json. it finds in my end, maybe related to the node.js version.
which version of node.js and npm are you using? the types are defined in the same place where
node.cjs
is and your project should be able to find them by mimetext's package.json. it finds in my end, maybe related to the node.js version.
Local v18.16.0/9.8.1 and the Github Action uses v18.19.0/10.2.3 - both builds are failing.
does your project's package.json has type: module
?
does your project's package.json has
type: module
?
No, it's CommonJS. I think, that's why "/node_modules/mimetext/build/entrypoints/node.cjs" is used by the compiler; which seems correct. "Just" the typing can't be resolved.
exactly, usage of import
syntax recognized by node only if package.json has type: module, otherwise require
syntax should be used. mimetext load itself according to this principle.
exactly, usage of
import
syntax recognized by node only if package.json has type: module, otherwiserequire
syntax should be used.
The import
syntax does work perfectly; we us it all over the place in 80+ repos. Problem here is the typing.
When I add "types": "./build/entrypoints/node.d.ts",
to the package.json of the mimetext package, the compiler ist happy; no error.
as long as you use es imports without type:module in package.json, node won't be able to find types, let me see if there is anything i can do without breaking current workflow.
Thanks for looking into this.
as long as you use es imports without type:module in package.json, node won't be able to find types
This does not solve the typing problem. Also, it worked with mimetext up to v3.0.17. The typings cannot be resolved, because Node doesn't find the correct files.
IMO the solution would be to either
"types": "./build/entrypoints/node.d.ts",
to the package.json, so that the Typescript compiler knows where to find themMaybe, this tool can help: https://arethetypeswrong.github.io/?p=mimetext%403.0.20
@maplesteve Running into the same issue. Just pinned it to 3.0.17 to get around the issue and so I could move on... this definitely wasn't a patch release!
@maplesteve thanks, just implemented both of your suggestions, could you verify if its working? v3.0.21
@muratgozel Thanks - no errors with v3.0.21
@danielrhodes could you check too please?
closing this issue as all typings should work as expected as of version v3.0.23
I import
createMimeMessage
It was working with v3.0.16. Starting with v3.0.17 the Typescript compiler yields an error:
Last version tested: v3.0.20. It still yields the above error.