File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ export type Unprefix < T extends Record < string , any > , Pre extends string > = {
2+ [ K in keyof T as K extends `${Pre } ${infer U } ` ? U : never ] : T [ K ] ;
3+ }
4+
5+ export type Prefix < T extends Record < string , any > , Pre extends string > = {
6+ // @ts -expect-error K in keyof T
7+ [ K in keyof T as `${Pre } ${K } `] : T [ K ] ;
8+ }
9+
10+ export type RenamePrefix <
11+ T extends Record < string , any > ,
12+ Old extends string ,
13+ New extends string ,
14+ > = Prefix < Unprefix < T , Old > , New >
15+
16+ /**
17+ * A literal type that supports custom further strings but preserves autocompletion in IDEs.
18+ *
19+ * @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609)
20+ */
21+ export type LiteralUnion < Union extends Base , Base = string > =
22+ | Union
23+ | ( Base & { zz_IGNORE_ME ?: never } )
24+
25+ export type RegExpLike = RegExp | `/${string } /`
You can’t perform that action at this time.
0 commit comments