finalhandler icon indicating copy to clipboard operation
finalhandler copied to clipboard

feat: add types

Open Phillip9587 opened this issue 9 months ago • 5 comments

This PR adds type definitions to finalhandler. It includes the following changes:

  • moving types from @types/finalhandler into the repository (https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/finalhandler)
  • adding type, main and types field to package.json
  • adding a tsconfig.json which extends @tsconfig/node18 from https://github.com/tsconfig/bases
  • adding type tests with @arethetypeswrong/cli and tsd

Ref: https://github.com/expressjs/typescript-wg/issues/1

cc @RobinTail @hichemfantar

Phillip9587 avatar Mar 26 '25 16:03 Phillip9587

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@arethetypeswrong/[email protected] Transitive: environment, filesystem, network, shell, unsafe +52 31.7 MB andrewbranch
npm/@tsconfig/[email protected] None 0 2.36 kB typescript-deploys
npm/@types/[email protected] None +1 83.3 kB
npm/[email protected] None 0 0 B
npm/[email protected] None 0 22.9 MB typescript-bot

View full report↗︎

socket-security[bot] avatar Mar 26 '25 16:03 socket-security[bot]

Hey @RobinTail, can you review again please? I implemented your suggestions.

Phillip9587 avatar Mar 26 '25 20:03 Phillip9587

Can we release this as a minor and recommend users to migrate away from @types/finalhandler to the built-in types, or would this require a major release?

Phillip9587 avatar Mar 27 '25 09:03 Phillip9587

Nope, this should be released in a major version, mainly because it could break TypeScript users, whether they use it with Express or not. Besides, it's not natural to add TypeScript support in a non-major version.

bjohansebas avatar Mar 27 '25 13:03 bjohansebas

Just to say, it's normal to release this in a minor version. Also, this is blocked until the types are officially accepted in the repositories.

bjohansebas avatar Jul 15 '25 02:07 bjohansebas