arktypea
arktype11mo ago
Micha

scope() how to bypass circular reference error?

I've implemented with Scope() successfully circular references, but somehow, I hit a limitation as this one still throws a circular reference error:

const types = scope({
  queryValue: "namedDocument", // As soon as I add here namedDocument the error appears
  queryValueObject: {
    "[string]": "queryValue",
  },

  "namedDocument<metadata extends queryValueObject = Record<string, never>>": {
    "data?": "metadata",
  }
}).export();


Error:
Type of property 'namedDocument' circularly references itself in mapped type '{ [k in "namedDocument<metadata extends queryValueObject>" as extractGenericName<k>]: GenericAst<conform<parseNextNameChar<skipWhitespace<extractParams<extractGenericParameters<k>>>, "", [], bootstrapAliases<...>>, array<...>>, { ...; }[k], "$", "$">; }'.ts(2615)
Was this page helpful?