File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -463,6 +463,15 @@ export const typedRegExp = <
463463 ? true
464464 : false
465465 ;
466+ // mustn't be inline and must be mapped for distributive reasons or smth idk
467+ type OmitTupleNumberKey < TCaptures extends Captures > = {
468+ [ K in keyof TCaptures as K extends number
469+ ? number extends TCaptures [ 'length' ]
470+ ? K
471+ : never
472+ : K
473+ ] : TCaptures [ K ]
474+ } ;
466475 type StrictRegExpExecArray < T extends string > = Override <
467476 Omit < RegExpExecArray , keyof unknown [ ] | 'indices' > ,
468477 {
@@ -471,9 +480,8 @@ export const typedRegExp = <
471480 : NamedCaptures ,
472481 input : T
473482 }
474- > & Omit < Captures , number extends Captures [ 'length' ]
475- ? never
476- : number
483+ > & OmitTupleNumberKey <
484+ Captures
477485 > & ( RegExpExecArray extends { indices : infer Indices }
478486 ? Is < HasFlag < 'd' > ,
479487 { indices : NonNullable < Indices > } ,
You can’t perform that action at this time.
0 commit comments