microsoft / microsoft/TypeScript
Version 5.0.4 -> 5.1.3 Regression when using generic types
Open
@weswigham is already working on this.
Since Jun 28, 2023.
Bug
Domain: check: Type Inference
Rescheduled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
Generic, 5.1.3
🕗 Version & Regression Information
- This changed between versions 5.0.4 and 5.1.3
⏯ Playground Link
💻 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>.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.