-
Notifications
You must be signed in to change notification settings - Fork 18
fix: remove nonnull assertions in favor of type narrowing #168
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
Conversation
WilliamBergamin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 💯 left non blocking comments
| * @see {@link ../shortcuts/sample-shortcut.ts} | ||
| * @see {@link https://www.typescriptlang.org/docs/handbook/2/narrowing.html} | ||
| */ | ||
| if (body.view?.type !== 'modal') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about adding a logger.warn rather then a comment 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'll hold off on this since other actions aren't configured at the moment - I believe modal actions are the only view this app receives from!
| // biome-ignore lint/style/noNonNullAssertion: view may be undefined, depending on the source of this action(did it come from an action within a conversation message or a modal?). take care! | ||
| view_id: body.view!.id, | ||
| // biome-ignore lint/style/noNonNullAssertion: view may be undefined, depending on the source of this action(did it come from an action within a conversation message or a modal?). take care! | ||
| hash: body.view!.hash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise 🙏
|
@WilliamBergamin @srtaalej Kind thanks for these reviews! I'm hoping we can continue to refine the |
Type of change
Summary
This PR removes non-null assertions in favor of type narrowing when updating the modal.
Reviewers
After building and running this app, run the shortcut then update the modal with the following slash command:
We hope all works the same!
Notes
This action responds to just the shortcut view AFAICT! Otherwise I think we'd be erroring here 😉
Requirements