import { StandardSchemaDictionary } from "../../@types/standard.js"; import { Extension, MergedExtensionDefine } from "../../@types/extension.js"; import { Format, Partial } from "ts-vista"; /** The complete options for an extension. */ type CompleteExtensionOptions[]> = { /** Inner extensions to merge. */extends: Ext; /** The env variable definitions. */ define: Define; }; /** Extension options with `extends`. */ type ExtensionOptions[]> = Format, "extends">>; /** * Structural return type of `createExtension`. * * Identical in shape to `Extension>` but * declared inline so that TypeScript does not re-check the * `StandardSchemaDictionary` constraint on the computed `MergedExtensionDefine` * at the generic declaration site. */ type FlattenedExtension[] = readonly never[]> = { define: MergedExtensionDefine; }; /** * Create an extension that can be passed to `createEnv` via the `extends` * option. * * Nested `define`s are flattened in array order. * The outer `define` wins on key collision. * * ### Example * * ```ts * const base = createExtension({ * define: { * NODE_ENV: z.enum(["development", "production"]), * }, * }); * * const withPort = createExtension({ * extends: [base], * define: { * PORT: z.number(), * }, * }); * * const env = createEnv({ * target: "server", * runtimeEnv: process.env, * extends: [ * withPort, * ], * define: { * API_URL: z.string().url(), * }, * }); * ``` */ declare function createExtension[] = readonly never[]>(extension: ExtensionOptions): FlattenedExtension; export { createExtension }; //# sourceMappingURL=extension.d.ts.map