Last active
October 13, 2023 13:59
-
-
Save barfi/44bfc0b4631247f81b0d32b3bd879f0c to your computer and use it in GitHub Desktop.
Revisions
-
barfi revised this gist
Oct 13, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ type RemovePrefixFromStruct<T> = { } const user = { name: 'John', age: 25, lastName: 'Doe' } satisfies RemovePrefixFromStruct<UserStruct> -
barfi revised this gist
Oct 13, 2023 . 1 changed file with 17 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,17 @@ type UserStruct = { 'prefix:name': string 'prefix:age': number lastName: string } type RemovePrefix<T> = T extends `prefix:${infer U}` ? U : T type RemovePrefixFromStruct<T> = { [K in keyof T as RemovePrefix<K>]: T[K] } const user = { name: 'Ivan', age: 25, lastName: 'Petrov' } satisfies RemovePrefixFromStruct<UserData> -
barfi created this gist
Oct 13, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ // s