Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

chore(types): make Props param in ShorthandValue and ShorthandCollection required #1605

Merged
merged 24 commits into from
Jul 15, 2019

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jul 9, 2019

BREAKING CHANGES

Only if you have used ShorthandValue or ShorthandCollection types.

Before

const item: ShorthandValue = {}
const items: ShorthandCollection = []

After

const item: ShorthandValue<ListItemProps> = {}
const items: ShorthandCollection<ListItemProps> = []

This PR makers P in ShorthandValue<P> required, this will allow to get better autocomplete, improve types and generate better prop definitions.

@codecov
Copy link

codecov bot commented Jul 9, 2019

Codecov Report

Merging #1605 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1605      +/-   ##
==========================================
+ Coverage   71.23%   71.24%   +0.01%     
==========================================
  Files         851      851              
  Lines        7032     7035       +3     
  Branches     2025     2027       +2     
==========================================
+ Hits         5009     5012       +3     
  Misses       2017     2017              
  Partials        6        6
Impacted Files Coverage Δ
packages/react/src/components/Chat/ChatItem.tsx 75% <ø> (ø) ⬆️
packages/react/src/components/Label/Label.tsx 95.23% <ø> (ø) ⬆️
packages/react/src/components/List/ListItem.tsx 100% <ø> (ø) ⬆️
packages/react/src/components/Segment/Segment.tsx 100% <ø> (ø) ⬆️
...react/src/components/Toolbar/ToolbarCustomItem.tsx 100% <ø> (ø) ⬆️
packages/react/src/components/Header/Header.tsx 100% <ø> (ø) ⬆️
packages/react/src/components/Popup/Popup.tsx 66.44% <ø> (ø) ⬆️
packages/react/src/components/Form/Form.tsx 100% <ø> (ø) ⬆️
...es/react/src/components/Reaction/ReactionGroup.tsx 100% <ø> (ø) ⬆️
packages/react/src/components/Slider/Slider.tsx 81.57% <ø> (ø) ⬆️
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 308fa1d...afd981e. Read the comment docs.

…/stardust-ui/react into chore/type-script

# Conflicts:
#	docs/src/prototypes/chatMessages/MessageReactionsWithPopup/index.tsx
#	packages/react/src/components/Button/ButtonGroup.tsx
#	packages/react/src/components/Dialog/Dialog.tsx
#	packages/react/src/components/Dropdown/Dropdown.tsx
#	packages/react/src/components/Form/Form.tsx
#	packages/react/src/components/Input/Input.tsx
#	packages/react/src/components/Reaction/ReactionGroup.tsx
#	packages/react/src/lib/factories.ts
#	packages/react/test/specs/lib/factories-test.tsx

/** Indicates whether the content is positioned at the start or the end. */
contentPosition?: 'start' | 'end'

/** Chat items can have a message. */
message?: ShorthandValue
message?: ShorthandValue<ChatMessageProps>
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this should be BoxProps, see line 109. We can easily do some miss match here.. :(

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch 👍

I am bit disappointed that we don't have strict checks there, but at least we will be able to improve them and catch such cases

@vercel vercel bot temporarily deployed to staging July 15, 2019 14:31 Inactive
@vercel vercel bot temporarily deployed to staging July 15, 2019 14:33 Inactive
@vercel vercel bot temporarily deployed to staging July 15, 2019 16:23 Inactive
Copy link
Contributor

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Don't forget to add changelog with BREAKING CHANGES entry.

@vercel vercel bot temporarily deployed to staging July 15, 2019 16:34 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants