xddq / ts2typebox

Creating TypeBox code from Typescript types
MIT License
42 stars 2 forks source link

v1.0.4 replace custom formatter with prettier #3

Closed xddq closed 1 year ago

xddq commented 1 year ago

uses prettier (with default config) as formatter for the generated typescript code. Will probably add ability to pass custom config somewhat later.

how to test

// Arbitrary example types

export type Address = {
  street: string;
  test: {
    a: string;
  };
};

export type Address2 = {
  street2: Address["test"]["a"];
};
import { Type, Static } from "@sinclair/typebox";

export type Address = Static<typeof Address>;
export const Address = Type.Object({
  street: Type.String(),
  test: Type.Object({
    a: Type.String(),
  }),
});

export type Address2 = Static<typeof Address2>;
export const Address2 = Type.Object({
  street2: Type.String(),
});