fern
fern copied to clipboard
[Feature] typescript: generate path parameters as destructured object
Problem description
Generated typescript client methods currently takes in path parameters individually, which is error prone as they are all string parameters.
E.g.,
...endpoints:
foo:
...
path-parameters:
aid: string
bid: string
cid: string
currently generates:
foo(aid: string, bid: string, cid: string, request: ..., requestOptions?: ...): Promise<void>
Why would it be useful?
In the above example, it is easy to mix up the order of the calling parameters (foo("aaa", "bbb", "ccc"...)
).
Describe the solution (optional)
Ideally, the sdk should generate something like:
foo({aid, bid, cid}: {aid: string, bid: string, cid: string}, request: ..., requestOptions?: ...): Promise<void>