Repository navigation
Conversation
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
There is also another problem - while Node.js can detect and run |
…stall guide The TypeScript setup section provides a tsconfig.json using "module": "nodenext" and demonstrates ESM import syntax in src/app.ts, but doesn't mention that package.json also needs "type": "module" set. Without it, TypeScript treats .ts files as CommonJS by default and throws ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. (ts1295) when following the guide as written. This adds the missing step so the example works out of the box. Signed-off-by: Jameel Ahmad <jameelahmad221b@gmail.com>
|
Thanks @krzysdz, good catch. That makes the missing step even more important: since this page has readers run |
krzysdz
left a comment
There was a problem hiding this comment.
This feels to verbose for a simple step in a "getting started" guide. It should be enough to just write that the type must be changed to "module", because the TypeScript examples use the module syntax.

Description
The TypeScript setup section provides a
tsconfig.jsonusing"module": "nodenext"and demonstrates ESMimportsyntax insrc/app.ts, but doesn't mention thatpackage.jsonalso needs"type": "module"set. Without it, TypeScript treats.tsfiles as CommonJS by default and throwsECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. (ts1295)when following the guide as written. This adds the missing step so the example works out of the box.Changes
tsconfig.jsonblock explaining that"module": "nodenext"requirespackage.jsonto declare"type": "module"package.jsoncode snippet showing the required fieldType of change