Skip to content

Conversation

@jurij-jukic
Copy link
Contributor

This is how it looks like in generated caller utils, for ease of reading:

export function parseResponse<T>(response: any): T {
  try {
    if ('Ok' in response && response.Ok !== undefined && response.Ok !== null) {
      return response.Ok as T;
    }

    if ('Err' in response && response.Err !== undefined) {
      throw new ApiError(`API returned an error`, response.Err);
    }
  } catch (e) {
    return response as T;
  }
  return response as T;

@jurij-jukic
Copy link
Contributor Author

#386

Copy link
Member

@nick1udwig nick1udwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jurij-jukic jurij-jukic merged commit 7876c5d into develop Oct 30, 2025
1 check passed
@jurij-jukic jurij-jukic deleted the j/hyperapp-return-any-type branch October 30, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants