Skip to content

Instantly share code, notes, and snippets.

@koistya
Created February 22, 2022 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koistya/3131c50722dd033f64abe6a4c19cdedf to your computer and use it in GitHub Desktop.
Save koistya/3131c50722dd033f64abe6a4c19cdedf to your computer and use it in GitHub Desktop.
interface PluginConfigTypes {
gtag: {
trackingID: string
}
otherPlugin: {
test: number
}
}
type Config<K extends keyof PluginConfigTypes> = {
title: string
plugins: K[]
} & Pick<PluginConfigTypes, K>
function createConfig<
K extends keyof PluginConfigTypes
>(config: Config<K>) {
return config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment