typescript-type 0.0.14-t → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/patterns/driver.ts +3 -10
package/package.json
CHANGED
package/patterns/driver.ts
CHANGED
|
@@ -64,18 +64,11 @@ export abstract class Driver<Config = any> {
|
|
|
64
64
|
): T => {
|
|
65
65
|
try {
|
|
66
66
|
// Check if it's a SchemaDefinition (has .parse method)
|
|
67
|
-
if (
|
|
67
|
+
if ('parse' in schema && typeof schema.parse === 'function') {
|
|
68
68
|
return (schema as SchemaDefinition<T>).parse(rawData);
|
|
69
69
|
}
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
return parseSync(schema as Type<T>, rawData);
|
|
73
|
-
}
|
|
74
|
-
// Try using .schema property if available (SchemaDefinition)
|
|
75
|
-
if (schema && typeof schema === 'object' && 'schema' in schema) {
|
|
76
|
-
return parseSync((schema as any).schema as Type<T>, rawData);
|
|
77
|
-
}
|
|
78
|
-
throw new Error(`Invalid schema type: ${typeof schema}`);
|
|
70
|
+
// Otherwise it's a raw Type
|
|
71
|
+
return parseSync(schema as Type<T>, rawData);
|
|
79
72
|
} catch (error: any) {
|
|
80
73
|
throw new BadConfigException([error.message || String(error)]);
|
|
81
74
|
}
|