I have a nodejs project writing in typescript. In some ts file I use require
and import
together, e.g. when using debugjs because it has cjs module only. I know there is @types/debug but since debugjs usage is rather straightforward I don't bother to use it. But expressjs is another story because I feel @types/express can help me better use express.
I know the difference between cjs and ej module, e.g. as Using Node.js require vs. ES6 import/export discussed, but since my ts files will be transpiled into cjs running inside nodejs (I don't use mjs
or set "type": "module"
in package.json), what is the problem is mixing require
and import
in the same typescript file?
So far I have not noticed any problem.