-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add Rich Text to SDK #80
Conversation
Samuel Barksdale seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report
@@ Coverage Diff @@
## main #80 +/- ##
=======================================
Coverage 96.09% 96.10%
=======================================
Files 41 41
Lines 1564 1565 +1
Branches 87 87
=======================================
+ Hits 1503 1504 +1
Misses 59 59
Partials 2 2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/functions/types.ts
Outdated
@@ -82,7 +82,8 @@ type FunctionInputRuntimeType< | |||
| typeof SlackSchemaTypes.user_id | |||
| typeof SlackSchemaTypes.usergroup_id | |||
| typeof SlackSchemaTypes.channel_id | |||
| typeof SlackSchemaTypes.date ? string | |||
| typeof SlackSchemaTypes.date | |||
| typeof SlackSchemaTypes.rich_text ? 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.
Could we set rich_text
to UnknownRuntimeType
instead of string
? This will treat it as any
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.
Should we keep date as typeof SlackSchemaTypes.date ? string
? I didn't realize how the ? operator is working here
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.
Just one change for the runtime type
src/functions/types.ts
Outdated
@@ -82,7 +82,8 @@ type FunctionInputRuntimeType< | |||
| typeof SlackSchemaTypes.user_id | |||
| typeof SlackSchemaTypes.usergroup_id | |||
| typeof SlackSchemaTypes.channel_id | |||
| typeof SlackSchemaTypes.date ? string | |||
| typeof SlackSchemaTypes.date | |||
| typeof SlackSchemaTypes.rich_text ? 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.
we should probably have this resolve to the UnknownRuntimeType
(which is an any
) - since it's a complex object at runtime and not a string. I believe you can just remove it from the checks here and it would fall into that condition below on line 88.
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.
ah are we saying to not include the entire line or to have the line | typeof SlackSchemaTypes.rich_text ? UnknownRuntimeType
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.
Good point, it would probably be better to be explicit here, so it would be more like adding a line at the end so we have another condition that matches specifically for rich text. So the block looks something like:
: Param["type"] extends
| typeof SlackSchemaTypes.user_id
| typeof SlackSchemaTypes.usergroup_id
| typeof SlackSchemaTypes.channel_id
| typeof SlackSchemaTypes.date ? string
: Param["type"] extends typeof SlackSchemaTypes.timestamp ? number
: Param["type"] extends typeof SlackSchemaTypes.rich_text ? UnknownRuntimeType
: UnknownRuntimeType;
Summary
Adding support for
RichTextValue
within the SDK.Previously we had to use
slack#/types/rich_text
to reference the Rich Text type but this changes allows us to useSchema.slack.types.rich_text
Requirements (place an
x
in each[ ]
)