import { identityFn } from "../../utils" import type { IdentityType } from "../schemas" import { TypeChecker, TypeCheckerBaseType, TypeInfo } from "../TypeChecker" const unchecked: IdentityType = new TypeChecker( TypeCheckerBaseType.Any, null, () => "any", (t) => new UncheckedTypeInfo(t), () => unchecked as any, identityFn, identityFn ) as any /** * A type that represents a given value that won't be type checked. * This is basically a way to bail out of the runtime type checking system. * * Example: * ```ts * const uncheckedSomeModel = types.unchecked() * const anyType = types.unchecked() * const customUncheckedType = types.unchecked<(A & B) | C>() * ``` * * @template T Type of the value, or unkown if not given. * @returns */ export function typesUnchecked(): IdentityType { return unchecked } /** * `types.unchecked` type info. */ export class UncheckedTypeInfo extends TypeInfo { readonly kind = "unchecked" }