ts-generator icon indicating copy to clipboard operation
ts-generator copied to clipboard

Added formatType to public api

Open hannukp opened this issue 3 years ago • 0 comments

Nice project :+1: . I'm using it to generate Promise-based http client API in addition to DTOs, and for that reason I needed to add formatType to the public API.

Then it's possible to do something like this to generate function signature:

val gen = TypeScriptGenerator(...)

val typescript = """function callMyApi(${param.name}: ${gen.formatType(param.type)}): Promise<${gen.formatType(returnType)}> {
    return http.get(...)
}
"""

hannukp avatar Mar 10 '22 10:03 hannukp