microsoft / microsoft/TypeScript

Version 5.0.4 -> 5.1.3 Regression when using generic types

Aperta
#54,805 2 commenti 4 reazioni 1 assegnatario Vedi su GitHub

@weswigham ci sta già lavorando.

Dal 28/6/2023.

Bug Domain: check: Type Inference Rescheduled
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Bug Report

🔎 Search Terms

Generic, 5.1.3

🕗 Version & Regression Information
  • This changed between versions 5.0.4 and 5.1.3
⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.1.3#code/C4TwDgpgBAMhAeBLAxgQwDYGED2BbXqAdgCYA8AKgAqojrarEB8UAvFAEoTLYBOZAzsB6JCAcwA0UQhABuEHowDcAKGWhIUAJKF+84OQTBqtesVYcIDbIXQhSAbyjBDALiiDhYqAF8lqgGYAroTIwIjWUMg8ls44+ERk5IwAFACUbnBIaFh4BCQUzPbKUCVQ0cCBPIRQ9t4q3qrcOsBaAHIAygCi7OQA+uSdABp9mADyALLjAIKtACIZCCgYcXlk2ro8+obGdAzMLMWR0aixuQlpikA

💻 Code
type LexicalCommand<TPayload> = Record<string, never>;

type InsertTextPayload = Readonly<{ text: string }>;

function createCommand<T>(): LexicalCommand<T> {
    return {};
}

const INSERT_TEXT_COMMAND: LexicalCommand<InsertTextPayload> =
  createCommand();
🙁 Actual behavior

The type of INSERT_TEXT_COMMAND is LexicalCommand<TPayload> in 5.1.3 (but LexicalCommand<InsertTextPayload> in 5.0.4).

🙂 Expected behavior

The type of INSERT_TEXT_COMMAND should be LexicalCommand<InsertTextPayload>.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.