Skip to content

fix(types): correct three ApiRocketChat return types - #433

Open
arbazkhan971 wants to merge 1 commit into
RocketChat:mobilefrom
arbazkhan971:fix-api-return-types
Open

arbazkhan971 wants to merge 1 commit into
RocketChat:mobilefrom
arbazkhan971:fix-api-return-types

Conversation

@arbazkhan971

Copy link
Copy Markdown

Summary

Fixes the three return-type bugs in ApiRocketChat from #381.

  • getRoomIdByNameOrId was typed as Promise<RID> but returns the REST body (the existing test pins this: "answers its result untouched"). The signature now matches that body. Rocket.Chat.ReactNative does not call this helper, so I did not unwrap to an id (that would be a behavior change).
  • channelInfo / privateInfo already unwrap .channel / .group. The as Promise<...> casts after await made the declared types Promise<Promise<...>>. They are now Promise<IChannelAPI> and Promise<IGroupAPI>.

Test plan

  • Existing lib/api/__tests__/RocketChat.spec.ts still records current runtime (25/25)
  • npm run lint
  • npm run typecheck

Fixes #381

Made with Cursor

getRoomIdByNameOrId returns the response body, not a room id string.
channelInfo and privateInfo already unwrap the channel/group; drop the
Promise casts that made their types Promise<Promise<...>>.

Fixes RocketChat#381

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

fix(types): correct three return types in ApiRocketChat that describe the wrong value

2 participants