18 lines
532 B
TypeScript
18 lines
532 B
TypeScript
import { Schema } from "effect"
|
|
import z from "zod"
|
|
|
|
import { Identifier } from "@/id/id"
|
|
import { ZodOverride } from "@/util/effect-zod"
|
|
import { Newtype } from "@/util/schema"
|
|
|
|
export class QuestionID extends Newtype<QuestionID>()(
|
|
"QuestionID",
|
|
Schema.String.annotate({ [ZodOverride]: Identifier.schema("question") }),
|
|
) {
|
|
static ascending(id?: string): QuestionID {
|
|
return this.make(Identifier.ascending("question", id))
|
|
}
|
|
|
|
static readonly zod = Identifier.schema("question") as unknown as z.ZodType<QuestionID>
|
|
}
|