expressjs / express

Fast, unopinionated, minimalist web framework for node.

Home Page:https://expressjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about typescript

rafaelbellintani opened this issue · comments

Is it safe to use @types/express? the last package has been update in 2021. There's another way to use express with ESM?

Is it safe to use @types/express?

Sure, why not?

the last package has been update in 2021

Express has been stable API wise for ±7 years now? So should be safe up to new TypeScript features from 2022.

There's another way to use express with ESM?

ESM, types and express are all unrelated stack-wise. You can use Node.js with ESM (name your file .mjs or set type: "module" in your package.json. You can use express with or without ESModules though as far as I know express does not expose named imports. You only need @types/express to get type safety with express when using TypeScript.

I'll also note that the types can sometimes update more or less frequently than the base project for various reasons. For example many bug fixes don't actually change the type interface, so may not need to update the types for thay, or there may be a miss in the types, so they update even when the project hasn't.

As far as the types, though I don't use typescript personally, I'm not aware of any critical issue with them and last time I looked over them, they seem quite accurate.