Skip to content

client["/endpoint"].GET style call pattern to enable go-to-definition #1526

Closed
@tonyxiao

Description

@tonyxiao

Description

Navigating from call site to docs (aka generated typing) today is quite inconvenient as vscode is not able to navigate from the path argument parameter to the type def. I would love to be able to use cmd+click to be able to go straight to the generated types for the specific endpoint. This is similar to how trpc would work

Proposal

Before

client.GET('/endpoint', { params: {} })

After

client['/endpoint'].GET({ params: {} })

This way you can cmd+click on the /endpoint part in VSCode to go straight to defintion

We can keep both call styles too (just like TRPC) for backward compat.

Checklist

Metadata

Metadata

Assignees

Labels

PRs welcomePRs are welcome to solve this issue!enhancementNew feature or requestopenapi-fetchRelevant to the openapi-fetch librarytrickyComplex problem which requires deep knowledge of TS, OpenAPI, this project, or all three

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions