-
Notifications
You must be signed in to change notification settings - Fork 0
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
Slack notification ts migration #124
base: main
Are you sure you want to change the base?
Conversation
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.
I think we want to only use type coercion when necessary. In most cases, we can remove null or undefined issues by adding a check first
Feedback is just on typing - the 🎩 worked no problem
@@ -39,15 +40,15 @@ export async function onSuccess({ params, record, logger, api, trigger }) { | |||
token: shop.slackAccessToken, | |||
channel: shop.slackChannelId, | |||
text: `You made a sale! ${ | |||
record.paymentDetails.credit_card_name || "Unknown" | |||
(record.paymentDetails as { credit_card_name?: string }) |
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.
This is a good reminder that we probably want some docs on working with JSON field values in TS
shopify/slack-notification-template/api/models/shopifyShop/actions/setSlackChannel.ts
Outdated
Show resolved
Hide resolved
shopify/slack-notification-template/api/models/shopifyShop/actions/uninstall.ts
Outdated
Show resolved
Hide resolved
@@ -151,17 +165,20 @@ const SlackChannelSelectionForm = ({ | |||
/> | |||
} | |||
> | |||
{options.length > 0 && ( | |||
{options.length > 0 ? ( | |||
<Listbox | |||
onSelect={(value) => { | |||
setInputValue( |
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.
is undefined valid? We can always check here and not set the input if it is not (so we don't have to cast as a string below)
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.
I'm not able to find an alternative
…ions/setSlackChannel.ts Co-authored-by: Riley Draward <[email protected]>
Co-authored-by: Riley Draward <[email protected]>
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.
🎩 ✅
One small type comment. It is a bummer that global actions don't return types (yet) because that would clean up the frontend a bit
Another small suggestion for the .template/docs/setup.md
file: for the SLACK_SCOPES
env var instruction, can we just provide the comma-separated list here? It is annoying to have to copy-paste or type out the 4 scopes manually
(channel) => channel.value === value | ||
)[0].label | ||
)[0].label as string |
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.
I think we can remove the as string here because the Channel type does not allow for null
or undefined
)[0].label as string | |
)[0].label |
Whoops, forgot to make this one