Skip to content

generate validation for string with jsodoc #42

@ryoppippi

Description

@ryoppippi

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

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