File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,11 +104,13 @@ export class DialogController<
104104 */
105105 async open (
106106 ...args : [
107- ...( Data extends undefined ? [ ] : [ data : Data ] ) ,
108- ...( OnFail extends OnFail . Close ? [ ] : [ formAction : DialogFormAction ] ) ,
107+ // Type parameters here are intentionally on the right side of `extends`
108+ // to prevent unions from distributing both choices of the conditional.
109+ ...( undefined extends Data ? [ ] : [ data : Data ] ) ,
110+ ...( OnFail . Close extends OnFail ? [ ] : [ formAction : DialogFormAction ] ) ,
109111 ]
110112 // @ts -expect-error TS can't prove the generic return type is correct.
111- ) : OnFail extends OnFail . Close ? Promise < string > : Promise < void > {
113+ ) : OnFail . Close extends OnFail ? Promise < string > : Promise < void > {
112114 if ( this . scope === undefined ) {
113115 throw new Error (
114116 "Can't open dialog since no `Dialog` component is using it" ,
You can’t perform that action at this time.
0 commit comments