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

Split up View type to improve TS linting #1276

Merged
merged 2 commits into from Aug 18, 2021
Merged

Conversation

alexjamesmalcolm
Copy link
Contributor

@alexjamesmalcolm alexjamesmalcolm commented Jun 29, 2021

Summary

There a View type. It has three subset types modal, home, and workflow_step. As I've discovered while consuming @slack/bolt there is a benefit to split these three up. Specifically that the modal subset requires the title field but the other two subsets have no use for it. If a consumer of this attempts to send a modal view without a title they will receive an error so by splitting up the single interface into three we can prevent the consumer from having to make the same mistake as myself to learn that although the title field is optional for a view, when type: "modal" is the case the title field is required.

I had to rely on these two pieces of documentation to get all of the fields correct:

Requirements (place an x in each [ ])

@gitwave gitwave bot added the untriaged label Jun 29, 2021
@CLAassistant
Copy link

CLAassistant commented Jun 29, 2021

CLA assistant check
All committers have signed the CLA.

@misscoded misscoded added area:typescript issues that specifically impact using the package from typescript projects enhancement M-T: A feature request for new functionality and removed untriaged labels Jun 29, 2021
@seratch seratch added the pkg:types applies to `@slack/types` label Jun 29, 2021
@seratch seratch added this to the types@2.2 milestone Jun 29, 2021
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

Thanks for the great pull request! Can you check my comment?

packages/types/src/index.ts Outdated Show resolved Hide resolved
The `submit_disabled` field is only available to `workflow_step` views.

Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

LGTM! Before merging this, I would like to wait for others' comments for a few days

@srajiang
Copy link
Member

I think we should be good to merge these changes in, unless there was further discussion to be had on this @seratch!

@seratch
Copy link
Member

seratch commented Aug 18, 2021

Thanks @srajiang, yes, we can merge this PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typescript issues that specifically impact using the package from typescript projects enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants