Created
August 9, 2022 03:25
-
-
Save tannerlinsley/1011ebc06c89e9436e5e809734bc1608 to your computer and use it in GitHub Desktop.
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
// my-core | |
interface FrameworkGenerics<TData = unknown> { | |
// Options: unknown | |
} | |
type GetFrameworkGeneric< | |
U, | |
TData = unknown, | |
> = U extends keyof FrameworkGenerics<TData> | |
? FrameworkGenerics<TData>[U] | |
: unknown | |
export function getCoreOptions (opts: GetFrameworkGeneric<'Options'>) { | |
return opts | |
} | |
// React Adapter | |
declare module 'my-core' { | |
interface FrameworkGenerics<TData = unknown> { | |
Options: { | |
react: true | |
} | |
} | |
} | |
// Vue Adapter | |
declare module 'my-core' { | |
interface FrameworkGenerics<TData = unknown> { | |
Options: { | |
vue: true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment