Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Oct 21, 2025

Type of change

  • Bug fix

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:

/run sample shortcut

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

  • I have ensured the changes I am contributing align with existing patterns and have tested and linted my code
  • I've read and agree to the Code of Conduct

@zimeg zimeg self-assigned this Oct 21, 2025
@zimeg zimeg added the bug Something isn't working label Oct 21, 2025
Copy link
Contributor

@WilliamBergamin WilliamBergamin left a 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') {
Copy link
Contributor

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 🤔 ?

Copy link
Member Author

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!

Comment on lines -12 to -15
// 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,
Copy link
Contributor

Choose a reason for hiding this comment

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

Praise 🙏

@zimeg
Copy link
Member Author

zimeg commented Oct 28, 2025

@WilliamBergamin @srtaalej Kind thanks for these reviews!

I'm hoping we can continue to refine the typescript experience across the SDKs and samples with these changes and similar-

@zimeg zimeg merged commit 552c1f4 into main Oct 28, 2025
4 checks passed
@zimeg zimeg deleted the zimeg-fix-ignore-null branch October 28, 2025 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants