Created
July 18, 2022 11:17
-
-
Save peterblazejewicz/60fe0c49d5dbae797f47dd3d50057516 to your computer and use it in GitHub Desktop.
Infer string literal
This file contains 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 characters
interface ApiData { | |
'maps:longitude': string; | |
'maps:latitude': string; | |
} | |
type RemoveMapsFromData<T> = { | |
[K in keyof T as RemoveMaps<K>]: T[K]; | |
}; | |
type ExpectedApiData = RemoveMapsFromData<ApiData>; | |
type RemoveMaps<T> = T extends `maps:${infer U}` ? U : T; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment