Open Stono opened 1 week ago
Start a new pull request in StackBlitz Codeflow.
I think you should be able to do if ('name' in operation) {}
to narrow it down as the object is a union with the experimental parser type which you shared above
The previous name
now seems to be id
. So I've updated our code to this:
{
name: '@hey-api/services',
methodNameBuilder: (operation) => {
const id = operation.id;
if (!id) {
throw new Error('Missing operation.id');
}
return //....
},
@KiwiKilian the answer is, kind of? With experimental parser, each operation has a unique id
. Without it, the interface is unchanged and contains name
too, but you need to narrow it down since with the new types it won't be autocompleted by default
Description
Trying to upgrade to the latest version and I noticed that the signature for methodNameBuilder has changed to now just passing a single operation object.
That's fine, however the operation object doesn't appear to have
name
on it:If i
console.log
the operation object out,name
is there, so this just looks like an accidental omission on the type?Reproducible example or configuration
https://stackblitz.com/edit/hey-api-client-fetch-example
OpenAPI specification (optional)
No response
System information (optional)
No response