Skip to content

Preserve declared constraints in generic signatures - #3162

Open
mayankdhingra02 wants to merge 1 commit into
TypeStrong:masterfrom
mayankdhingra02:codex/preserve-signature-constraints
Open

mayankdhingra02 wants to merge 1 commit into
TypeStrong:masterfrom
mayankdhingra02:codex/preserve-signature-constraints

Conversation

@mayankdhingra02

Copy link
Copy Markdown

Fixes #3156.

TypeDoc used the compiler's base constraint when converting a signature's type parameters. That widened K extends keyof T and erased or widened U extends T. The converter now uses the declared constraint with any inherited type substitutions applied.

Added regression coverage for functions, arrows, constructors, and inherited methods. Updated the renderer snapshot so the constraint links to its type parameter.

Verified with pnpm run build, pnpm run lint, and pnpm run test:full. Also checked CLI JSON with TypeScript 5.0, 5.9, and 6.0.

This branch has not been deployed

No deployments
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.

Signature type parameter constraints are shown as their base constraint (K extends keyof T becomes K extends string | number | symbol)

1 participant