Skip to content

feat: add types#104

Open
Phillip9587 wants to merge 1 commit intojshttp:masterfrom
Phillip9587:types
Open

feat: add types#104
Phillip9587 wants to merge 1 commit intojshttp:masterfrom
Phillip9587:types

Conversation

@Phillip9587
Copy link
Contributor

This PR adds type definitions to content-dispotition. It includes the following changes:

Ref: expressjs/typescript-wg#1

I plan to further improve the types once they are merged.

cc @bjohansebas @jonchurch @clicktodev

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive TypeScript type definitions to the content-disposition package, transitioning type management from DefinitelyTyped to the package repository itself.

Key Changes:

  • Adds TypeScript type definitions in index.d.ts with interfaces for ContentDisposition and Options
  • Configures package for TypeScript with tsconfig.json extending @tsconfig/node18
  • Adds type testing infrastructure using expect-type and @arethetypeswrong/cli with CI integration

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
index.d.ts Defines TypeScript types for the contentDisposition function, parse method, and related interfaces
package.json Adds type-related fields (type, main, types), devDependencies for TypeScript tooling, and test-types script
tsconfig.json Configures TypeScript compiler to extend Node 18 base configuration
test/types.ts Provides type checking tests using expect-type to verify API contracts
.github/workflows/ci.yml Adds test-types job to CI pipeline for automated type checking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@socket-security
Copy link

socket-security bot commented Dec 16, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​tsconfig/​node18@​18.2.61001007188100
Added@​arethetypeswrong/​cli@​0.18.210010010084100
Addedexpect-type@​1.3.010010010086100
Addedtypescript@​5.9.31001009010090

View full report

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blakeembrey
Copy link
Member

Would you be interested in making a PR to use TypeScript and generate the types instead? I'm more comfortable doing that personally.

Also just a heads up but I think this will be a major change based on discussions about the policy of types IIRC, so I'd love to bundle it with some meaningful rewriting for performance and removing regexes in the next major.

@bjohansebas
Copy link
Member

Hey @blakeembrey, I’m not sure we actually want to rewrite every module to TypeScript. As far as I remember, and since I’ve been in the project, there has been opposition to rewriting every package to TypeScript. The solution for adding types was to create a working group to add and maintain the types.

@blakeembrey
Copy link
Member

As far as I remember, and since I’ve been in the project, there has been opposition to rewriting every package to TypeScript.

I believe I got it to the point where it was the captains discretion, and I'm opposed to maintaining independent types and in favor of native TypeScript. Happy to rehash that discussion though.

@Phillip9587
Copy link
Contributor Author

I'm fine with rewriting to TypeScript and support this decision.

@bjohansebas
Copy link
Member

I believe I got it to the point where it was the captains discretion, and I'm opposed to maintaining independent types and in favor of native TypeScript. Happy to rehash that discussion though.

If that’s the case, I’m happy to continue and to help you migrate your packages to TypeScript. And honestly, I support it being at the captains’ discretion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants