Last active
July 25, 2020 12:58
-
-
Save fangbinwei/0b16fdafaa4d83701b194ecbbb2a139d to your computer and use it in GitHub Desktop.
typescript type from values in array
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
export const extraKeys = [ | |
'app', | |
'title', | |
'package', | |
'deeplink', | |
'url', | |
'logo', | |
'image', | |
'type' | |
] as const | |
export type Extra = { | |
[key in typeof extraKeys[number]]: string | |
} | |
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment