Skip to content

build: include bundled TypeScript declarations#407

Open
jeanpierrecarvalho wants to merge 1 commit intoexpressjs:masterfrom
jeanpierrecarvalho:feat/include-bundled-types
Open

build: include bundled TypeScript declarations#407
jeanpierrecarvalho wants to merge 1 commit intoexpressjs:masterfrom
jeanpierrecarvalho:feat/include-bundled-types

Conversation

@jeanpierrecarvalho
Copy link
Copy Markdown

Summary

  • add bundled index.d.ts copied from the current @types/cors definitions
  • expose the declarations through the package types field and include them in the published files list
  • keep the legacy headers option alias typed, marked as deprecated, to match current runtime behavior

Why

Issue #235 asks to ship TypeScript definitions with cors instead of requiring a separate @types/cors install.

This change keeps the types lightweight and aligned with the current middleware API while improving the out-of-the-box TypeScript experience for consumers.

Impact

TypeScript users can install cors alone and get bundled declarations immediately.

Existing code using the legacy headers alias continues to type-check, while new code is steered toward allowedHeaders.

Validation

  • npm test
  • local Express + TypeScript smoke test against the file-linked package, including cors(), cors.CorsOptionsDelegate<Request>, and the legacy headers alias

Addresses #235.

@jeanpierrecarvalho jeanpierrecarvalho marked this pull request as ready for review March 30, 2026 19:33
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.

1 participant