Skip to content

Optional parameters #10

Open
Open
@1cedsoda

Description

I want to generate this code. notice the optional method paramter.

export class Client {
  constructor(axiosInstance?: AxiosInstance) {
  }
}

This is my tsx:

<Class named="Client">
  <ClassMethod name="constructor" params={[
    <Identifier typeAnnotation="AxiosInstance">
      axiosInstance
    </Identifier>
  ]}>
  </ClassMethod>
</Class>

This code was generated:

class Client {
  constructor(axiosInstance: AxiosInstance) {
  }
}

How do I generate optional method parameters?

It would be great if there were some kinds of docs or more examples on how to build common js/ts patterns.

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