-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsHelp WantedYou can do thisYou can do thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Bug Report
π Search Terms
Intellisense, incorrect function parameter
π Version & Regression Information
Tried with v4.3.5
β― Playground Link
π» Code
declare const send:
(event: { type: "A", foo: string } | { type: "B" } | "B") => void
declare const sendOnlyObject:
(event: { type: "A", foo: string } | { type: "B" }) => void
send({ type: "A" })
// Type '"A"' is not assignable to type '"B"'.(2322)
sendOnlyObject({ type: "A" })
// Argument of type '{ type: "A"; }' is not assignable to parameter of type '{ type: "A"; foo: string; } | { type: "B"; }'.
// Property 'foo' is missing in type '{ type: "A"; }' but required in type '{ type: "A"; foo: string; }'.(2345)π Actual behavior
The error for send({ type: "A" }) is Type '"A"' is not assignable to type '"B"'
π Expected behavior
The error should be something like the one for sendOnlyObject or at least not misleading that the property type has to be "B" that's what is getting suggested here.
Metadata
Metadata
Assignees
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsHelp WantedYou can do thisYou can do thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript