Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate validation for string with jsodoc #42

Open
ryoppippi opened this issue May 31, 2024 · 0 comments
Open

generate validation for string with jsodoc #42

ryoppippi opened this issue May 31, 2024 · 0 comments

Comments

@ryoppippi
Copy link

ryoppippi commented May 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant