UNPKG

804 BTypeScriptView Raw
1import type { ConfigRecipes } from "./generated/recipes.gen";
2import type { RecipeDefinition, RecipeVariantMap, RecipeVariantProps, SystemRecipeFn } from "./recipe.types";
3export type RecipeKey = keyof ConfigRecipes | (string & {});
4export interface UseRecipeOptions<K extends RecipeKey> {
5 key?: K;
6 recipe?: RecipeDefinition;
7}
8export declare function useRecipe<Options extends {
9 key: RecipeKey;
10 recipe?: RecipeDefinition;
11}>(options: Options): Options["key"] extends keyof ConfigRecipes ? ConfigRecipes[Options["key"]] : SystemRecipeFn<{}, {}>;
12export declare function useRecipe<Options extends {
13 recipe: RecipeDefinition;
14}>(options: Options): Options["recipe"] extends RecipeDefinition<infer T> ? SystemRecipeFn<RecipeVariantProps<Options["recipe"]>, RecipeVariantMap<T>> : never;