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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/patterns/driver.ts +3 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-type",
3
- "version": "0.0.14-t",
3
+ "version": "0.0.14",
4
4
  "description": "Typescript type",
5
5
  "scripts": {
6
6
  "clean": "rm -rf node_modules/ && rm -rf .nyc_output/ && rm -rf package-lock.json"
@@ -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 (schema && typeof schema === 'object' && 'parse' in schema && typeof (schema as any).parse === 'function') {
67
+ if ('parse' in schema && typeof schema.parse === 'function') {
68
68
  return (schema as SchemaDefinition<T>).parse(rawData);
69
69
  }
70
- // Check if schema is callable (arktype Type)
71
- if (typeof schema === 'function') {
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
  }