Skip to content

TypeScriptToModel fails with type that contains a self reference #32

@jeffrey-peterson-vanna

Description

@jeffrey-peterson-vanna

I'm working with TS files that contain references to types defined in the same interface. TypeScriptToModel seems to be using Recursive types for this scenario but fails when the nesting is more than one level deep.

Example:

import * as Codegen from '@sinclair/typebox-codegen';

const Code = `
  interface foo {
    bar: {
      ref: foo['bar']['baz'];
      baz: {};
    };
  }
`;

const boom = Codegen.TypeScriptToModel.Generate(Code);

TypeBox Workbench link

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions