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

[v2] Suggest string literals on IDE when typing the kind of conversation in <ConversationsSelect include> #145

Merged
merged 4 commits into from
Apr 20, 2020

Conversation

yhatt
Copy link
Owner

@yhatt yhatt commented Apr 17, 2020

include prop of <ConversationsSelect> allows string type, to accept the space-separated kind of conversations. jsx-slack v1 has suggested the kind while typing array value through <Conversations include={[]}>, but not while typing a string.

I've improved its type definition for auto-suggestion on IDE to work the suggestion in string.

type FilterIncludeKind = 'im' | 'mpim' | 'private' | 'public'
type SpaceSeparatedKind = string & { _?: never }

interface FilterProps {
  include?: FilterIncludeKind | FilterIncludeKind[] | SpaceSeparatedKind
}

This hack is called as LiteralUnion in microsoft/TypeScript#29729 (comment).

@yhatt yhatt merged commit a4e256f into v2 Apr 20, 2020
@yhatt yhatt deleted the v2-filter-literal-union branch April 20, 2020 01:02
@yhatt yhatt mentioned this pull request Apr 20, 2020
8 tasks
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.

1 participant