Skip to content

Instantly share code, notes, and snippets.

@ivawzh
Last active July 10, 2020 20:36
Show Gist options
  • Save ivawzh/693aced4f5a0a84c6a057cd56082ad1e to your computer and use it in GitHub Desktop.
Save ivawzh/693aced4f5a0a84c6a057cd56082ad1e to your computer and use it in GitHub Desktop.
TS-TypeUtils
type TransformObjValueType<OBJ extends {[k: string]: string}, NEW_TYPE> =
{[K in keyof OBJ]: NEW_TYPE}
// Usage:
type Secrets = {[k: string]: string}
type ContainerSecrets = TransformObjValueType<Secrets, EcsSecret>
// now type ContainerSecrets = {[k: string]: EcsSecret}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment