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

Add Rich Text to SDK #80

Merged
merged 4 commits into from
Aug 19, 2022
Merged

Add Rich Text to SDK #80

merged 4 commits into from
Aug 19, 2022

Conversation

sbarksdale97
Copy link
Contributor

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 use Schema.slack.types.rich_text

Requirements (place an x in each [ ])

@sbarksdale97 sbarksdale97 requested a review from a team as a code owner August 17, 2022 19:05
@CLAassistant
Copy link

CLAassistant commented Aug 17, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ sbarksdale97
✅ selfcontained
✅ shapirone
❌ Samuel Barksdale


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
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #80 (a806b9c) into main (fbc6c5f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           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           
Impacted Files Coverage Δ
src/schema/slack/types/mod.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -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
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Contributor

@selfcontained selfcontained left a 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

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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;

@selfcontained selfcontained merged commit 65a9425 into main Aug 19, 2022
@selfcontained selfcontained deleted the sam_add_rich_text_sdk branch August 19, 2022 00:49
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.

None yet

4 participants