UNPKG

@tsed/schema

Version:
14 lines (13 loc) 397 B
import { JsonEntityStore } from "../domain/JsonEntityStore.js"; import { JsonLazyRef } from "../domain/JsonLazyRef.js"; export function lazyRef(cb) { try { // solve issue with a self referenced model if (cb()) { // type is already accessible return JsonEntityStore.from(cb()).schema; } } catch (er) { } return new JsonLazyRef(cb); }