Skip to content

feat: hyperapp returns any Rust type, not just Result#391

Merged
jurij-jukic merged 1 commit intodevelopfrom
j/hyperapp-return-any-type
Oct 30, 2025
Merged

feat: hyperapp returns any Rust type, not just Result#391
jurij-jukic merged 1 commit intodevelopfrom
j/hyperapp-return-any-type

Conversation

@jurij-jukic
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

#386

Copy link
Copy Markdown
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.

2 participants