import { array, intersection, literal, partial, recursion, type, Type, type TypeOf, undefined as Undefined, union } from 'io-ts'; import { type Student as _Student, type Teacher as _Teacher } from '@runtyping/test-type-writers/fixtures/source/circular-references'; // This file is generated by runtyping (https://github.com/johngeorgewright/runtyping). // Manual changes might be lost - proceed with caution! export const Teacher: Type<_Teacher> = recursion('Teacher', () => intersection([type({ type: literal("teacher"), }), partial({ students: union([array(Student), Undefined,]), reportsTo: union([Teacher, Undefined,]), })])); export type Teacher = TypeOf; export const Student: Type<_Student> = recursion('Student', () => type({ type: literal("student"), teacher: Teacher, })); export type Student = TypeOf; export const User = union([Student, Teacher,]); export type User = TypeOf;