Repository navigation
Seek most-overlapping types when relating object types in unions #26450
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging
on Aug 14, 2018 I'm not sure if this is a valid ask. Would it be possible to use the most-overlapping declaration in error message for overloads too?
declare function f(a: string, b: string, c: string): void; declare function f(a: () => string, b: () => string, c: () => string): void; f('1', '1', {});
Actual
ERROR(3,3): : Argument of type '"1"' is not assignable to parameter of type '() => string'.
Expected
ERROR(3,13): : Argument of type '{}' is not assignable to parameter of type 'string'.DanielRosenwasser commented
on Aug 15, 2018 MemberAuthorMore actionsBowen Ni (@bowenni) I think that is a UX improvement we want to see, but I'd rather we file a different issue there. Overload resolution is pretty complicated and would warrant its own work item.
Reacted by Bowen NiCyrusNajmabadi commented
on Aug 30, 2018 ContributorMore actionsA vote on this over from Pulumi land. We have extensive use of union types, and errors here can be painful :)
Similar problem with Vue.
Code:
Vue.extend({ props: { value: null } })
3.0.1:
Argument of type '{ props: { value: null; }; }' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>>'. Types of property 'props' are incompatible. Type '{ value: null; }' is not assignable to type 'string[] | RecordPropsDefinition<Record<string, any>> | undefined'. Type '{ value: null; }' is not assignable to type 'undefined'.2.9.2:
Argument of type '{ props: { value: null; }; }' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Rec...'. Type '{ props: { value: null; }; }' is not assignable to type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Rec...'. Types of property 'props' are incompatible. Type '{ value: null; }' is not assignable to type 'string[] | RecordPropsDefinition<Record<string, any>> | undefined'. Type '{ value: null; }' is not assignable to type 'RecordPropsDefinition<Record<string, any>>'. Property 'value' is incompatible with index signature. Type 'null' is not assignable to type 'PropValidator<any>'.DanielRosenwasser commented
on Sep 14, 2018 MemberAuthorMore actionsDoesn't "dive in" to the objects like Joe Duffy (@joeduffy) and Cyrus Najmabadi (@CyrusNajmabadi) were hoping for, but a fix is up on #27087. Maybe Wesley Wigham (@weswigham) has some ideas here.
- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on Nov 26, 2018 - locked as resolved and limited conversation to collaborators
on Oct 21, 2025
From Rado Kirov (@rkirov) at DefinitelyTyped/DefinitelyTyped#28044 (comment)
Expected
Actual