File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1- import type { z } from 'zod'
21import type { ValidateFn } from '@poppinss/validator-lite'
32import type { StandardSchemaV1 } from '@standard-schema/spec'
3+ import type { z } from 'zod'
44
55/**
66 * Schema defined by the user
@@ -19,22 +19,11 @@ export type FullPluginOptions = (
1919 | { validator : 'standard' ; schema : StandardSchema }
2020) & { debug ?: boolean ; configFile ?: string }
2121
22- /**
23- * Contract for schema definition for poppins validator
24- */
2522export type PoppinsSchema = RecordViteKeys < ValidateFn < any > >
26-
27- /**
28- * Contract for schema definition for zod validator
29- */
3023export type ZodSchema = RecordViteKeys < z . ZodType < any , any > >
31-
32- /**
33- * Contract for schema definition for standard-schema validator
34- */
3524export type StandardSchema = RecordViteKeys < StandardSchemaV1 >
3625
37- export type Schema = PoppinsSchema | ZodSchema
26+ export type Schema = PoppinsSchema | ZodSchema | StandardSchema
3827
3928/**
4029 * Infer the schema type from the plugin options
@@ -50,7 +39,9 @@ type EnvValue<Fn> = Fn extends (...args: any) => any
5039 ? ReturnType < Fn >
5140 : Fn extends z . ZodType
5241 ? z . infer < Fn >
53- : never
42+ : Fn extends StandardSchemaV1
43+ ? StandardSchemaV1 . InferOutput < Fn >
44+ : never
5445
5546/**
5647 * Augment the import.meta.env object with the values returned by the schema validator
You can’t perform that action at this time.
0 commit comments