-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(config-tools): Included types definition with package
- Loading branch information
1 parent
cb3b2bf
commit d4176fb
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as z from "zod"; | ||
import { StormConfigSchema } from "./src/schema"; | ||
|
||
type TStormConfig = z.infer<typeof StormConfigSchema>; | ||
|
||
declare type StormConfig< | ||
TExtensionName extends | ||
keyof TStormConfig["extensions"] = keyof TStormConfig["extensions"], | ||
TExtensionConfig extends | ||
TStormConfig["extensions"][TExtensionName] = TStormConfig["extensions"][TExtensionName] | ||
> = TStormConfig & { | ||
extensions: | ||
| (TStormConfig["extensions"] & { | ||
[extensionName in TExtensionName]: TExtensionConfig; | ||
}) | ||
| {}; | ||
}; | ||
export { StormConfig }; | ||
|
||
/** | ||
* Type-check to determine if `obj` is a `StormError` object | ||
* | ||
* @param value - the object to check | ||
* @returns The function isStormError is returning a boolean value. | ||
*/ | ||
declare function createStormConfig< | ||
TExtensionName extends | ||
keyof StormConfig["extensions"] = keyof StormConfig["extensions"], | ||
TExtensionConfig extends Record<string, any> = Record<string, any>, | ||
TExtensionSchema extends | ||
z.ZodType<TExtensionConfig> = z.ZodType<TExtensionConfig> | ||
>( | ||
extensionName?: TExtensionName, | ||
schema?: TExtensionSchema | ||
): StormConfig<TExtensionName, TExtensionConfig>; | ||
export { createStormConfig }; |
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
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
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