Skip to content

Commit

Permalink
remove schema static annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jul 21, 2024
1 parent 2851561 commit cb8300c
Showing 1 changed file with 10 additions and 49 deletions.
59 changes: 10 additions & 49 deletions packages/schema/src/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5762,10 +5762,7 @@ export class DateTimeUtcFromSelf extends declare(
arbitrary: (): LazyArbitrary<dateTime.Utc> => (fc) => fc.date().map((date) => dateTime.unsafeFromDate(date)),
equivalence: () => dateTime.Equivalence
}
) {
static override annotations: (annotations: Annotations.Schema<dateTime.Utc>) => typeof DateTimeUtcFromSelf = super
.annotations
}
) {}

const decodeDateTime = <A extends dateTime.DateTime.Input>(input: A, _: ParseOptions, ast: AST.AST) =>
ParseResult.try({
Expand All @@ -5787,11 +5784,7 @@ export class DateTimeUtcFromNumber extends transformOrFail(
decode: decodeDateTime,
encode: (dt) => ParseResult.succeed(dateTime.toEpochMillis(dt))
}
).annotations({ identifier: "DateTimeUtcFromNumber" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.Utc>
) => typeof DateTimeUtcFromNumber = super.annotations
}
).annotations({ identifier: "DateTimeUtcFromNumber" }) {}

/**
* Defines a schema that attempts to convert a `string` to a `DateTime.Utc` instance using the `DateTime.unsafeMake` constructor.
Expand All @@ -5807,11 +5800,7 @@ export class DateTimeUtc extends transformOrFail(
decode: decodeDateTime,
encode: (dt) => ParseResult.succeed(dateTime.formatIso(dt))
}
).annotations({ identifier: "DateTime.Utc" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.Utc>
) => typeof DateTimeUtc = super.annotations
}
).annotations({ identifier: "DateTime.Utc" }) {}

const timeZoneOffsetArbitrary = (): LazyArbitrary<dateTime.TimeZone.Offset> => (fc) =>
fc.integer({ min: -12 * 60 * 60 * 1000, max: 12 * 60 * 60 * 1000 }).map((offset) => dateTime.zoneMakeOffset(offset))
Expand All @@ -5830,11 +5819,7 @@ export class TimeZoneOffsetFromSelf extends declare(
pretty: (): pretty_.Pretty<dateTime.TimeZone.Offset> => (zone) => `TimeZone.Offset(${zone.offset})`,
arbitrary: timeZoneOffsetArbitrary
}
) {
static override annotations: (
annotations: Annotations.Schema<dateTime.TimeZone.Offset>
) => typeof TimeZoneOffsetFromSelf = super.annotations
}
) {}

/**
* Defines a schema that attempts to convert a `number` to a `TimeZone.Offset` instance using the `DateTime.zoneMakeOffset` constructor.
Expand All @@ -5846,11 +5831,7 @@ export class TimeZoneOffset extends transform(
Number$,
TimeZoneOffsetFromSelf,
{ strict: true, decode: (n) => dateTime.zoneMakeOffset(n), encode: (tz) => tz.offset }
).annotations({ identifier: "TimeZoneOffset" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.TimeZone.Offset>
) => typeof TimeZoneOffset = super.annotations
}
).annotations({ identifier: "TimeZoneOffset" }) {}

const timeZoneNamedArbitrary = (): LazyArbitrary<dateTime.TimeZone.Named> => (fc) =>
fc.constantFrom(...Intl.supportedValuesOf("timeZone")).map((id) => dateTime.zoneUnsafeMakeNamed(id))
Expand All @@ -5869,11 +5850,7 @@ export class TimeZoneNamedFromSelf extends declare(
pretty: (): pretty_.Pretty<dateTime.TimeZone.Named> => (zone) => `TimeZone.Named(${zone.id})`,
arbitrary: timeZoneNamedArbitrary
}
) {
static override annotations: (
annotations: Annotations.Schema<dateTime.TimeZone.Named>
) => typeof TimeZoneNamedFromSelf = super.annotations
}
) {}

/**
* Defines a schema that attempts to convert a `string` to a `TimeZone.Named` instance using the `DateTime.zoneUnsafeMakeNamed` constructor.
Expand All @@ -5893,11 +5870,7 @@ export class TimeZoneNamed extends transformOrFail(
}),
encode: (tz) => ParseResult.succeed(tz.id)
}
).annotations({ identifier: "TimeZoneNamed" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.TimeZone.Named>
) => typeof TimeZoneNamed = super.annotations
}
).annotations({ identifier: "TimeZoneNamed" }) {}

/**
* @category api interface
Expand Down Expand Up @@ -5931,11 +5904,7 @@ export class TimeZone extends transformOrFail(
}),
encode: (tz) => ParseResult.succeed(dateTime.zoneToString(tz))
}
).annotations({ identifier: "TimeZone" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.TimeZone>
) => typeof TimeZone = super.annotations
}
).annotations({ identifier: "TimeZone" }) {}

const timeZoneArbitrary: LazyArbitrary<dateTime.TimeZone> = (fc) =>
fc.oneof(
Expand All @@ -5959,11 +5928,7 @@ export class DateTimeZonedFromSelf extends declare(
fc.date().chain((date) => timeZoneArbitrary(fc).map((timeZone) => dateTime.unsafeMakeZoned(date, { timeZone }))),
equivalence: () => dateTime.Equivalence
}
) {
static override annotations: (
annotations: Annotations.Schema<dateTime.Zoned>
) => typeof DateTimeZonedFromSelf = super.annotations
}
) {}

/**
* Defines a schema that attempts to convert a `string` to a `DateTime.Zoned` instance.
Expand All @@ -5983,11 +5948,7 @@ export class DateTimeZoned extends transformOrFail(
}),
encode: (dt) => ParseResult.succeed(dateTime.zonedToString(dt))
}
).annotations({ identifier: "DateTime.Zoned" }) {
static override annotations: (
annotations: Annotations.Schema<dateTime.Zoned>
) => typeof DateTimeZoned = super.annotations
}
).annotations({ identifier: "DateTime.Zoned" }) {}

/**
* @category Option utils
Expand Down

0 comments on commit cb8300c

Please sign in to comment.