Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make StatusApiResponse type a discriminate union #161

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamesdawsonWD
Copy link

@jamesdawsonWD jamesdawsonWD commented Apr 18, 2024

Motivation

While working on integrating farcaster at work, I found this type to be inaccurate. This new type will allow for separate type states dependent on the status.

Change Summary

Convert StatusApiResponse type to discriminate union

Merge Checklist

  • PR title adheres to the conventional commits standard
  • PR has a changeset
  • PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore)
  • PR includes documentation if necessary
  • All commits have been signed

@jamesdawsonWD jamesdawsonWD changed the title fix: make StatusApiResponse type a discrimitive union fix: make StatusApiResponse type a discriminate union Apr 18, 2024
@deodad
Copy link
Member

deodad commented Apr 18, 2024

Thanks! Looks good but I think these properties should be optional as well since they aren't enforced at the protocol level (e.g. you can have an FID w/ no displayName set)

@jamesdawsonWD
Copy link
Author

@deodad updated those optional types!

@jamesdawsonWD
Copy link
Author

I have also updated the docs and created a PR for this, if you decide to go ahead with the change.

@deodad
Copy link
Member

deodad commented Apr 19, 2024

thanks @jamesdawsonWD could you also address the TS errors in auth-kit

sds pushed a commit to farcasterxyz/docs that referenced this pull request Jun 16, 2024
This doc update is linked to [this
PR](farcasterxyz/auth-monorepo#161)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the structure of the `data` object in the `status.md`
file within the auth-kit client app to have separate shapes for
"pending" and "completed" states.

### Detailed summary
- Separated `data` object into two shapes: "pending" and "completed"
- Added `url`, `message`, `signature`, `fid` fields for "completed"
state
- Updated `state` field to be a string literal for both shapes

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
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