Skip to content

Version 5.0.4 -> 5.1.3 Regression when using generic typesΒ #54805

Open
@chentsulin

Description

@chentsulin

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions