Skip to content

TypeScript v5 missing typeArguments with default generics #2213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Shinigami92 opened this issue Mar 27, 2023 · 1 comment
Closed

TypeScript v5 missing typeArguments with default generics #2213

Shinigami92 opened this issue Mar 27, 2023 · 1 comment
Labels
wontfix Declining to implement

Comments

@Shinigami92
Copy link

Shinigami92 commented Mar 27, 2023

Search terms

  • typeArguments
  • generics
  • TypeScript v5

Expected Behavior

We have defined a type:

// ./types.ts
export type LiteralUnion<T extends U, U = string> =
  | T
  | (U & { zz_IGNORE_ME?: never });

// ./index.ts
export type Test = LiteralUnion<'a' | 'b'>;

TypeScript v4.x produced

type.typeArguments[0] -> "'a' | 'b'"
type.typeArguments[1] -> "string"

image

Actual Behavior

TypeScript v5.x produced

type.typeArguments[0] -> "'a' | 'b'"

Steps to reproduce the bug

Repro: TypeStrong/typedoc-repros#27

Relevant issue: faker-js/faker#1953

Environment

  • Typedoc version: 0.24.0-beta.7 | 0.23
  • TypeScript version: v5.0.2
  • Node.js version: 18
  • OS: mac
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 1, 2023

TypeDoc is converting what we get from TypeScript correctly, and this is an intentional change in TypeScript 5.0 - microsoft/TypeScript#51771.

TypeScript still has some work to do to be consistent about when defaulted type parameters are included (see Anders' follow up comment), but from some discussion with Jake Bailey, they're far more likely to move towards not eagerly expanding alias lists than revert this change (see also microsoft/TypeScript#52670)

@Gerrit0 Gerrit0 added the wontfix Declining to implement label Apr 1, 2023
@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2023
@Gerrit0 Gerrit0 removed the bug label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix Declining to implement
Projects
None yet
Development

No branches or pull requests

2 participants