typebox-codegen icon indicating copy to clipboard operation
typebox-codegen copied to clipboard

generate validation for string with jsodoc

Open ryoppippi opened this issue 1 year ago • 0 comments

It is really great if string with jsodoc generate correct validation for JS/TS

currently:

const code = `
/**
* @format email
*/
type V = string;
`
const model = Codegen.TypeScriptToModel.Generate(code);
console.log(Codegen.ModelToTypeScript.Generate(model));

Result:

export type V = string
export const V = (() => {
  function check_V(value: any): boolean {
    return typeof value === 'string' && format('email', value)
  }
  return function check(value: any): value is V {
    return check_V(value)
  }
})()

I cannot find the implementation of format

ryoppippi avatar May 31 '24 16:05 ryoppippi