@nmtjs/type 0.6.4 → 0.7.0

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 (76) hide show
  1. package/dist/index.js +31 -31
  2. package/dist/index.js.map +1 -1
  3. package/dist/temporal.js +7 -8
  4. package/dist/temporal.js.map +1 -1
  5. package/dist/types/any.js +4 -4
  6. package/dist/types/any.js.map +1 -1
  7. package/dist/types/array.js +23 -23
  8. package/dist/types/array.js.map +1 -1
  9. package/dist/types/base.js +65 -66
  10. package/dist/types/base.js.map +1 -1
  11. package/dist/types/boolean.js +4 -4
  12. package/dist/types/boolean.js.map +1 -1
  13. package/dist/types/custom.js +10 -9
  14. package/dist/types/custom.js.map +1 -1
  15. package/dist/types/date.js +6 -13
  16. package/dist/types/date.js.map +1 -1
  17. package/dist/types/enum.js +7 -16
  18. package/dist/types/enum.js.map +1 -1
  19. package/dist/types/literal.js +7 -6
  20. package/dist/types/literal.js.map +1 -1
  21. package/dist/types/never.js +4 -4
  22. package/dist/types/never.js.map +1 -1
  23. package/dist/types/number.js +26 -93
  24. package/dist/types/number.js.map +1 -1
  25. package/dist/types/object.js +42 -31
  26. package/dist/types/object.js.map +1 -1
  27. package/dist/types/string.js +31 -47
  28. package/dist/types/string.js.map +1 -1
  29. package/dist/types/temporal.js +40 -41
  30. package/dist/types/temporal.js.map +1 -1
  31. package/dist/types/union.js +25 -18
  32. package/dist/types/union.js.map +1 -1
  33. package/dist/utils.js +0 -1
  34. package/dist/utils.js.map +1 -1
  35. package/package.json +7 -19
  36. package/src/index.ts +24 -25
  37. package/src/temporal.ts +8 -8
  38. package/src/types/any.ts +5 -3
  39. package/src/types/array.ts +24 -22
  40. package/src/types/base.ts +148 -81
  41. package/src/types/boolean.ts +5 -3
  42. package/src/types/custom.ts +43 -24
  43. package/src/types/date.ts +17 -16
  44. package/src/types/enum.ts +12 -22
  45. package/src/types/literal.ts +9 -6
  46. package/src/types/never.ts +5 -3
  47. package/src/types/number.ts +31 -93
  48. package/src/types/object.ts +44 -37
  49. package/src/types/string.ts +41 -39
  50. package/src/types/temporal.ts +72 -32
  51. package/src/types/union.ts +59 -50
  52. package/src/utils.ts +22 -22
  53. package/dist/compiler.js +0 -55
  54. package/dist/compiler.js.map +0 -1
  55. package/dist/formats.js +0 -127
  56. package/dist/formats.js.map +0 -1
  57. package/dist/inference.js +0 -1
  58. package/dist/inference.js.map +0 -1
  59. package/dist/parse.js +0 -145
  60. package/dist/parse.js.map +0 -1
  61. package/dist/runtime.js +0 -73
  62. package/dist/runtime.js.map +0 -1
  63. package/dist/schemas/default.js +0 -6
  64. package/dist/schemas/default.js.map +0 -1
  65. package/dist/schemas/discriminated-union.js +0 -9
  66. package/dist/schemas/discriminated-union.js.map +0 -1
  67. package/dist/schemas/nullable.js +0 -11
  68. package/dist/schemas/nullable.js.map +0 -1
  69. package/src/compiler.ts +0 -100
  70. package/src/formats.ts +0 -182
  71. package/src/inference.ts +0 -128
  72. package/src/parse.ts +0 -217
  73. package/src/runtime.ts +0 -137
  74. package/src/schemas/default.ts +0 -12
  75. package/src/schemas/discriminated-union.ts +0 -49
  76. package/src/schemas/nullable.ts +0 -20
package/src/types/enum.ts CHANGED
@@ -1,27 +1,17 @@
1
- import { type TEnum, Type } from '@sinclair/typebox'
1
+ import { type core, enum as enum_, type ZodMiniEnum } from '@zod/mini'
2
2
  import { BaseType } from './base.ts'
3
3
 
4
- export class ObjectEnumType<
5
- T extends { [K in string]: K } = { [K in string]: K },
6
- > extends BaseType<TEnum<T>, { values: T[keyof T] }, T[keyof T]> {
7
- static factory<T extends { [K in string]: K }>(values: T) {
8
- return new ObjectEnumType<T>(Type.Enum(values as any), {
9
- values: Object.values(values) as unknown as T[keyof T],
10
- })
11
- }
12
- }
13
-
14
4
  export class EnumType<
15
- T extends (string | number)[] = (string | number)[],
16
- > extends BaseType<
17
- TEnum<Record<string, T[number]>>,
18
- { values: [...T] },
19
- T[keyof T]
20
- > {
21
- static factory<T extends (string | number)[]>(values: [...T]) {
22
- return new EnumType<T>(
23
- Type.Enum(Object.fromEntries(values.map((v) => [v, v])) as any),
24
- { values },
25
- )
5
+ T extends core.utils.EnumLike = core.utils.EnumLike,
6
+ > extends BaseType<ZodMiniEnum<T>, ZodMiniEnum<T>, { values: T }> {
7
+ static factory<T extends core.utils.EnumLike>(values: T): EnumType<T>
8
+ static factory<T extends string[]>(
9
+ values: T,
10
+ ): EnumType<core.utils.ToEnum<T[number]>>
11
+ static factory<T extends core.utils.EnumLike | string[]>(values: T) {
12
+ return new EnumType({
13
+ encodedZodType: enum_(values as any),
14
+ props: { values },
15
+ })
26
16
  }
27
17
  }
@@ -1,10 +1,13 @@
1
- import { type TLiteral, type TLiteralValue, Type } from '@sinclair/typebox'
2
- import { BaseType } from './base.ts'
1
+ import { literal, type ZodMiniLiteral } from '@zod/mini'
2
+ import { BaseType, type PrimitiveValueType } from './base.ts'
3
3
 
4
4
  export class LiteralType<
5
- T extends TLiteralValue = TLiteralValue,
6
- > extends BaseType<TLiteral<T>, { value: TLiteralValue }, T> {
7
- static factory<T extends TLiteralValue>(value: T) {
8
- return new LiteralType<T>(Type.Literal(value), { value })
5
+ T extends PrimitiveValueType = PrimitiveValueType,
6
+ > extends BaseType<ZodMiniLiteral<T>, ZodMiniLiteral<T>, { value: T }> {
7
+ static factory<T extends PrimitiveValueType>(value: T) {
8
+ return new LiteralType<T>({
9
+ encodedZodType: literal(value),
10
+ props: { value },
11
+ })
9
12
  }
10
13
  }
@@ -1,8 +1,10 @@
1
- import { type TNever, Type } from '@sinclair/typebox'
1
+ import { never, type ZodMiniNever } from '@zod/mini'
2
2
  import { BaseType } from './base.ts'
3
3
 
4
- export class NeverType extends BaseType<TNever, {}, never> {
4
+ export class NeverType extends BaseType<ZodMiniNever> {
5
5
  static factory() {
6
- return new NeverType(Type.Never())
6
+ return new NeverType({
7
+ encodedZodType: never(),
8
+ })
7
9
  }
8
10
  }
@@ -1,117 +1,55 @@
1
1
  import {
2
- type BigIntOptions,
3
- type IntegerOptions,
4
- type NumberOptions,
5
- type TBigInt,
6
- type TInteger,
7
- type TNumber,
8
- Type,
9
- } from '@sinclair/typebox'
2
+ type core,
3
+ gt,
4
+ gte,
5
+ int,
6
+ lt,
7
+ lte,
8
+ number,
9
+ type ZodMiniNumber,
10
+ } from '@zod/mini'
10
11
  import { BaseType } from './base.ts'
11
12
 
13
+ type Check = core.CheckFn<number> | core.$ZodCheck<number>
14
+
12
15
  export class NumberType extends BaseType<
13
- TNumber,
14
- { options: NumberOptions },
15
- number
16
+ ZodMiniNumber<number>,
17
+ ZodMiniNumber<number>,
18
+ { checks: Check[] }
16
19
  > {
17
- static factory(options: NumberOptions = {}) {
18
- return new NumberType(Type.Number(options), { options })
19
- }
20
-
21
- positive() {
22
- return this.min(0, true)
23
- }
24
-
25
- negative() {
26
- return this.max(0, true)
27
- }
28
-
29
- max(value: number, exclusive?: true) {
30
- return NumberType.factory({
31
- ...this.props.options,
32
- maximum: value,
33
- ...(!exclusive ? {} : { exclusiveMaximum: value }),
20
+ static factory(...checks: Check[]) {
21
+ return new NumberType({
22
+ encodedZodType: number().check(...checks),
34
23
  })
35
24
  }
36
25
 
37
- min(value: number, exclusive?: true) {
38
- return NumberType.factory({
39
- ...this.props.options,
40
- minimum: value,
41
- ...(!exclusive ? {} : { exclusiveMinimum: value }),
42
- })
43
- }
44
- }
45
-
46
- export class IntegerType extends BaseType<
47
- TInteger,
48
- { options: IntegerOptions },
49
- number
50
- > {
51
- static factory(options: IntegerOptions = {}) {
52
- return new IntegerType(Type.Integer(options), { options })
53
- }
54
-
55
26
  positive() {
56
- return this.min(0, true)
27
+ return NumberType.factory(...this.props.checks, gte(0))
57
28
  }
58
29
 
59
30
  negative() {
60
- return this.max(0, true)
61
- }
62
-
63
- max(value: number, exclusive?: true) {
64
- return IntegerType.factory({
65
- ...this.props.options,
66
- maximum: value,
67
- ...(!exclusive ? {} : { exclusiveMaximum: value }),
68
- })
69
- }
70
-
71
- min(value: number, exclusive?: true) {
72
- return IntegerType.factory({
73
- ...this.props.options,
74
- minimum: value,
75
- ...(!exclusive ? {} : { exclusiveMinimum: value }),
76
- })
31
+ return NumberType.factory(...this.props.checks, lte(0))
77
32
  }
78
- }
79
33
 
80
- // TODO: this is not json schema compatible
81
- export class BigIntType extends BaseType<
82
- TBigInt,
83
- { options: BigIntOptions },
84
- bigint
85
- > {
86
- static factory(options: BigIntOptions = {}) {
87
- return new BigIntType(
88
- Type.BigInt(options),
89
- { options },
90
- { encode: (value) => `${value}` },
91
- )
34
+ lt(value: number) {
35
+ return NumberType.factory(...this.props.checks, lt(value))
92
36
  }
93
37
 
94
- positive() {
95
- return this.min(0n, true)
38
+ lte(value: number) {
39
+ return NumberType.factory(...this.props.checks, lte(value))
96
40
  }
97
41
 
98
- negative() {
99
- return this.max(0n, true)
42
+ gte(value: number) {
43
+ return NumberType.factory(...this.props.checks, gte(value))
100
44
  }
101
45
 
102
- max(value: bigint, exclusive?: true) {
103
- return BigIntType.factory({
104
- ...this.props.options,
105
- maximum: value,
106
- ...(!exclusive ? {} : { exclusiveMaximum: value }),
107
- })
46
+ gt(value: number) {
47
+ return NumberType.factory(...this.props.checks, gt(value))
108
48
  }
49
+ }
109
50
 
110
- min(value: bigint, exclusive?: true) {
111
- return BigIntType.factory({
112
- ...this.props.options,
113
- minimum: value,
114
- ...(!exclusive ? {} : { exclusiveMinimum: value }),
115
- })
51
+ export class IntegerType extends NumberType {
52
+ static factory(...checks: Check[]) {
53
+ return NumberType.factory(...checks, int())
116
54
  }
117
55
  }
@@ -1,64 +1,73 @@
1
1
  import {
2
- type ObjectOptions,
3
- type TObject,
4
- type TRecordOrObject,
5
- type TSchema,
6
- Type,
7
- } from '@sinclair/typebox'
8
- import type { StaticInputDecode } from '../inference.ts'
9
- import type { UnionToTupleString } from '../utils.ts'
2
+ type core,
3
+ object,
4
+ record,
5
+ type ZodMiniObject,
6
+ type ZodMiniRecord,
7
+ } from '@zod/mini'
8
+
10
9
  import { BaseType, type BaseTypeAny, type OptionalType } from './base.ts'
11
- import { EnumType, type ObjectEnumType } from './enum.ts'
10
+ import { EnumType } from './enum.ts'
12
11
  import type { LiteralType } from './literal.ts'
13
12
  import type { StringType } from './string.ts'
14
13
 
15
14
  export type ObjectTypeProps = { [k: string]: BaseTypeAny }
16
15
  export type AnyObjectType = ObjectType<ObjectTypeProps>
17
16
  export class ObjectType<T extends ObjectTypeProps = {}> extends BaseType<
18
- TObject<{ [K in keyof T]: T[K]['schema'] }>,
19
- { properties: T },
20
- StaticInputDecode<TObject<{ [K in keyof T]: T[K]['schema'] }>>
17
+ ZodMiniObject<{ [K in keyof T]: T[K]['encodedZodType'] }>,
18
+ ZodMiniObject<{ [K in keyof T]: T[K]['decodedZodType'] }>,
19
+ { properties: T }
21
20
  > {
22
- static factory<T extends ObjectTypeProps = {}>(
23
- properties: T,
24
- options: ObjectOptions = {},
25
- ) {
26
- const schemaProperties = {} as {
27
- [K in keyof T]: T[K]['schema']
21
+ static factory<T extends ObjectTypeProps = {}>(properties: T) {
22
+ const encodeProperties = {} as {
23
+ [K in keyof T]: T[K]['encodedZodType']
24
+ }
25
+ const decodeProperties = {} as {
26
+ [K in keyof T]: T[K]['decodedZodType']
28
27
  }
29
28
 
30
29
  for (const key in properties) {
31
- schemaProperties[key] = properties[key].schema
30
+ encodeProperties[key] = properties[key].encodedZodType
31
+ decodeProperties[key] = properties[key].decodedZodType
32
32
  }
33
33
 
34
- return new ObjectType<T>(Type.Object(schemaProperties, options) as any, {
35
- properties,
34
+ return new ObjectType<T>({
35
+ encodedZodType: object(encodeProperties),
36
+ decodedZodType: object(decodeProperties),
37
+ props: { properties },
36
38
  })
37
39
  }
38
40
  }
39
41
 
40
42
  export class RecordType<
41
- K extends LiteralType | EnumType | ObjectEnumType | StringType,
43
+ K extends LiteralType<string | number> | EnumType | StringType,
42
44
  E extends BaseType,
43
- > extends BaseType<TRecordOrObject<K['schema'], E['schema']>> {
45
+ > extends BaseType<
46
+ ZodMiniRecord<K['encodedZodType'], E['encodedZodType']>,
47
+ ZodMiniRecord<K['decodedZodType'], E['decodedZodType']>
48
+ > {
44
49
  static factory<
45
- K extends
46
- | LiteralType<any>
47
- | EnumType<any>
48
- | ObjectEnumType<any>
49
- | StringType,
50
+ K extends LiteralType<string | number> | EnumType | StringType,
50
51
  E extends BaseType,
51
- >(key: K, element: E, options: ObjectOptions = {}) {
52
- return new RecordType<K, E>(
53
- Type.Record(key.schema, element.schema, options) as any,
54
- )
52
+ >(key: K, element: E) {
53
+ return new RecordType<K, E>({
54
+ encodedZodType: record(
55
+ (key as any).encodedZodType,
56
+ element.encodedZodType,
57
+ ),
58
+ decodedZodType: record(
59
+ (key as any).decodedZodType,
60
+ element.decodedZodType,
61
+ ),
62
+ props: { key, element },
63
+ })
55
64
  }
56
65
  }
57
66
 
58
67
  export function keyof<T extends ObjectType>(
59
68
  type: T,
60
69
  ): EnumType<
61
- UnionToTupleString<T extends ObjectType<infer Props> ? keyof Props : never>
70
+ core.utils.ToEnum<Extract<keyof T['props']['properties'], string>>
62
71
  > {
63
72
  return EnumType.factory(Object.keys(type.props.properties) as any)
64
73
  }
@@ -139,9 +148,7 @@ export function partial<
139
148
  >(
140
149
  object: T,
141
150
  ): ObjectType<{
142
- [K in keyof P]: P[K] extends BaseType<any, any, infer T>
143
- ? OptionalType<P[K], T>
144
- : never
151
+ [K in keyof P]: OptionalType<P[K]>
145
152
  }> {
146
153
  const properties = {} as any
147
154
 
@@ -149,5 +156,5 @@ export function partial<
149
156
  properties[key] = value.optional()
150
157
  }
151
158
 
152
- return ObjectType.factory(properties, {}) as any
159
+ return ObjectType.factory(properties)
153
160
  }
@@ -1,63 +1,65 @@
1
- import { type StringOptions, type TString, Type } from '@sinclair/typebox'
2
- import type { StaticOutputDecode } from '../inference.ts'
1
+ import {
2
+ type core,
3
+ email,
4
+ ipv4,
5
+ ipv6,
6
+ maxLength,
7
+ minLength,
8
+ regex,
9
+ string,
10
+ url,
11
+ uuid,
12
+ type ZodMiniString,
13
+ } from '@zod/mini'
14
+
3
15
  import { BaseType } from './base.ts'
4
16
 
17
+ type Check = core.CheckFn<string> | core.$ZodCheck<string>
18
+
5
19
  export class StringType extends BaseType<
6
- TString,
7
- { options: StringOptions },
8
- string
20
+ ZodMiniString<string>,
21
+ ZodMiniString<string>,
22
+ { checks: Check[] }
9
23
  > {
10
- static factory(options: StringOptions = {}) {
11
- return new StringType(Type.String(options), { options })
24
+ static factory(...checks: Check[]) {
25
+ return new StringType({
26
+ encodedZodType: string().check(...checks),
27
+ props: { checks },
28
+ })
12
29
  }
13
30
 
14
31
  max(value: number) {
15
- return StringType.factory({
16
- ...this.props.options,
17
- maxLength: value,
18
- })
32
+ return StringType.factory(...this.props.checks, maxLength(value))
19
33
  }
20
34
 
21
35
  min(value: number) {
22
- return StringType.factory({
23
- ...this.props.options,
24
- minLength: value,
25
- })
36
+ return StringType.factory(...this.props.checks, minLength(value))
26
37
  }
27
38
 
28
- format(format: TString['format']) {
29
- return StringType.factory({
30
- ...this.props.options,
31
- pattern: undefined,
32
- format,
33
- })
34
- }
35
-
36
- pattern(pattern: string) {
37
- return StringType.factory({
38
- ...this.props.options,
39
- format: undefined,
40
- pattern,
41
- })
39
+ pattern(pattern: string | RegExp) {
40
+ return StringType.factory(
41
+ ...this.props.checks,
42
+ regex(typeof pattern === 'string' ? new RegExp(pattern) : pattern),
43
+ )
42
44
  }
43
45
 
44
- email() {
45
- return this.format('email')
46
+ email(options?: core.$ZodEmailParams) {
47
+ return StringType.factory(...this.props.checks, email(options))
46
48
  }
47
49
 
48
- url() {
49
- return this.format('uri')
50
+ url(options?: core.$ZodURLParams) {
51
+ return StringType.factory(...this.props.checks, url(options))
50
52
  }
51
53
 
52
- ipv4() {
53
- return this.format('ipv4')
54
+ ipv4(options?: core.$ZodIPv4Params) {
55
+ return StringType.factory(...this.props.checks, ipv4(options))
54
56
  }
55
57
 
56
- ipv6() {
57
- return this.format('ipv6')
58
+ ipv6(options?: core.$ZodIPv6Params) {
59
+ return StringType.factory(...this.props.checks, ipv6(options))
58
60
  }
59
61
 
60
- uuid() {
61
- return this.format('uuid')
62
+ uuid(options?: core.$ZodUUIDParams) {
63
+ return StringType.factory(...this.props.checks, uuid(options))
62
64
  }
63
65
  }
@@ -1,4 +1,9 @@
1
- import { type TString, Type } from '@sinclair/typebox'
1
+ import {
2
+ custom,
3
+ string,
4
+ type ZodMiniCustom,
5
+ type ZodMiniString,
6
+ } from '@zod/mini'
2
7
  import { Temporal } from 'temporal-polyfill'
3
8
  import { CustomType, TransformType } from './custom.ts'
4
9
 
@@ -29,102 +34,137 @@ const createTemporalTransformer = <T extends Types>(
29
34
  } as TemporalTransformer<T>
30
35
  }
31
36
 
32
- export class PlainDateType extends TransformType<Temporal.PlainDate, TString> {
33
- static readonly transformer = createTemporalTransformer('PlainDate')
37
+ export class PlainDateType extends TransformType<
38
+ Temporal.PlainDate,
39
+ ZodMiniString
40
+ > {
41
+ static transformer = createTemporalTransformer('PlainDate')
34
42
 
35
43
  static factory() {
36
- return CustomType.factory(
44
+ return CustomType.factory<
45
+ Temporal.PlainDate,
46
+ ZodMiniString,
47
+ ZodMiniCustom<Temporal.PlainDate, Temporal.PlainDate>
48
+ >(
37
49
  PlainDateType.transformer.decode,
38
50
  PlainDateType.transformer.encode,
39
- Type.String(),
51
+ string(),
40
52
  )
41
53
  }
42
54
  }
43
55
 
44
56
  export class PlainDateTimeType extends TransformType<
45
57
  Temporal.PlainDateTime,
46
- TString
58
+ ZodMiniString
47
59
  > {
48
- static readonly transformer = createTemporalTransformer('PlainDateTime')
49
- protected _encode = PlainDateTimeType.transformer.encode
60
+ static transformer = createTemporalTransformer('PlainDateTime')
50
61
 
51
62
  static factory() {
52
- return CustomType.factory(
63
+ return CustomType.factory<
64
+ Temporal.PlainDateTime,
65
+ ZodMiniString,
66
+ ZodMiniCustom<Temporal.PlainDateTime, Temporal.PlainDateTime>
67
+ >(
53
68
  PlainDateTimeType.transformer.decode,
54
69
  PlainDateTimeType.transformer.encode,
55
- Type.String(),
70
+ string(),
56
71
  )
57
72
  }
58
73
  }
59
74
 
60
75
  export class ZonedDateTimeType extends TransformType<
61
76
  Temporal.ZonedDateTime,
62
- TString
77
+ ZodMiniString
63
78
  > {
64
- static readonly transformer = createTemporalTransformer(
65
- 'ZonedDateTime',
66
- (value) => Temporal.Instant.from(value).toZonedDateTimeISO('UTC'),
79
+ static transformer = createTemporalTransformer('ZonedDateTime', (value) =>
80
+ Temporal.Instant.from(value).toZonedDateTimeISO('UTC'),
67
81
  )
68
82
 
69
83
  static factory() {
70
- return CustomType.factory(
84
+ return CustomType.factory<
85
+ Temporal.ZonedDateTime,
86
+ ZodMiniString,
87
+ ZodMiniCustom<Temporal.ZonedDateTime, Temporal.ZonedDateTime>
88
+ >(
71
89
  ZonedDateTimeType.transformer.decode,
72
90
  ZonedDateTimeType.transformer.encode,
73
- Type.String(),
91
+ string(),
74
92
  )
75
93
  }
76
94
  }
77
95
 
78
- export class PlainTimeType extends TransformType<Temporal.PlainTime, TString> {
79
- static readonly transformer = createTemporalTransformer('PlainTime')
96
+ export class PlainTimeType extends TransformType<
97
+ Temporal.PlainTime,
98
+ ZodMiniString
99
+ > {
100
+ static transformer = createTemporalTransformer('PlainTime')
80
101
 
81
102
  static factory() {
82
- return CustomType.factory(
103
+ return CustomType.factory<
104
+ Temporal.PlainTime,
105
+ ZodMiniString,
106
+ ZodMiniCustom<Temporal.PlainTime, Temporal.PlainTime>
107
+ >(
83
108
  PlainTimeType.transformer.decode,
84
109
  PlainTimeType.transformer.encode,
85
- Type.String(),
110
+ string(),
86
111
  )
87
112
  }
88
113
  }
89
114
 
90
- export class DurationType extends TransformType<Temporal.Duration, TString> {
91
- static readonly transformer = createTemporalTransformer('Duration')
115
+ export class DurationType extends TransformType<
116
+ Temporal.Duration,
117
+ ZodMiniString
118
+ > {
119
+ static transformer = createTemporalTransformer('Duration')
92
120
 
93
121
  static factory() {
94
- return CustomType.factory(
122
+ return CustomType.factory<
123
+ Temporal.Duration,
124
+ ZodMiniString,
125
+ ZodMiniCustom<Temporal.Duration, Temporal.Duration>
126
+ >(
95
127
  DurationType.transformer.decode,
96
128
  DurationType.transformer.encode,
97
- Type.String(),
129
+ string(),
98
130
  )
99
131
  }
100
132
  }
101
133
 
102
134
  export class PlainYearMonthType extends TransformType<
103
135
  Temporal.PlainYearMonth,
104
- TString
136
+ ZodMiniString
105
137
  > {
106
- static readonly transformer = createTemporalTransformer('PlainYearMonth')
138
+ static transformer = createTemporalTransformer('PlainYearMonth')
107
139
 
108
140
  static factory() {
109
- return CustomType.factory(
141
+ return CustomType.factory<
142
+ Temporal.PlainYearMonth,
143
+ ZodMiniString,
144
+ ZodMiniCustom<Temporal.PlainYearMonth, Temporal.PlainYearMonth>
145
+ >(
110
146
  PlainYearMonthType.transformer.decode,
111
147
  PlainYearMonthType.transformer.encode,
112
- Type.String(),
148
+ string(),
113
149
  )
114
150
  }
115
151
  }
116
152
 
117
153
  export class PlainMonthDayType extends TransformType<
118
154
  Temporal.PlainMonthDay,
119
- TString
155
+ ZodMiniString
120
156
  > {
121
- static readonly transformer = createTemporalTransformer('PlainMonthDay')
157
+ static transformer = createTemporalTransformer('PlainMonthDay')
122
158
 
123
159
  static factory() {
124
- return CustomType.factory(
160
+ return CustomType.factory<
161
+ Temporal.PlainMonthDay,
162
+ ZodMiniString,
163
+ ZodMiniCustom<Temporal.PlainMonthDay, Temporal.PlainMonthDay>
164
+ >(
125
165
  PlainMonthDayType.transformer.decode,
126
166
  PlainMonthDayType.transformer.encode,
127
- Type.String(),
167
+ string(),
128
168
  )
129
169
  }
130
170
  }