Skip to content

Optional return value definition does not include undefined #148

@invliD

Description

@invliD

What happened?

A method with an optional return value gets generated as method(…): Promise<T | null>. That's correct if the server returns a JSON result of null. If the server responds with a 204 instead, the return value is undefined as the runtime is currently implemented. An alternative would be to change the runtime to return null in the 204 case, but I believe the runtime is correct here since 204 means "no content", which I'd translate as "the return value is not defined".

What did you want to happen?

The correct definition encompassing both cases should be method(…): Promise<T | null | undefined>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions