-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type changes around
StyledOptions
/FilteringStyledOptions
and `sho…
…uldForwardProp` (#2333) * chore(style): let StyledOptions generic argument be optional * chore(native): let StyledOptions generic argument be optional * test(types): add tests for StyledOptions iface * feat(types): add keys assertion for StyledOptions generic * fix(styled): add StyledOptions type to CreateStyledComponent call signature fixes #2333 (comment) * test(styled): check type StyledOpts for composite component * test(styled): revert erroneous changes * test(styled): clarify StyledOptsBroken test case * test: refactor `styledOptions` generics tests * test: add more tests for StyledOptions * test: linting * test: tweak ups * feat: expose FilteringStyledOptions * fix: expost `FilteringStyledOptions` from native, tweak up some tests, add some comments * chore: use consistent default props type for both StyledOptions and FilteringStyledOptions * chore: snap #3 * styled.shouldForwardProp: require prop to be a string * Add PropertyKey->string changesets * Remove redundant `compilerOptions` * make `shouldForwardProp` always contravariant * Type fixes * Tweak `FilteringStyledOptions` and `StyledOptions` interfaces * Change `Props` constraint * Tweak type-level tests around `shouldForwardProp` * add changesets Co-authored-by: Sam Magura <[email protected]> Co-authored-by: Mateusz Burzyński <[email protected]>
- Loading branch information
1 parent
f5c80c8
commit 3055efd
Showing
11 changed files
with
166 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@emotion/native': patch | ||
'@emotion/styled': patch | ||
--- | ||
|
||
pr: #2759 | ||
author: @srmagura | ||
author: @Andarist | ||
|
||
Change the argument of the `shouldForwardProp` option of `styled` from `PropertyKey` to `string` in the TypeScript definitions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@emotion/is-prop-valid': patch | ||
--- | ||
|
||
pr: #2759 | ||
author: @srmagura | ||
|
||
Change the type of the argument to `isPropValid` from `PropertyKey` to `string` in the TypeScript definitions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@emotion/native': patch | ||
'@emotion/styled': patch | ||
--- | ||
|
||
author: @Andarist | ||
|
||
`shouldForwardProp` has been changed from being a bivariant method to a contravariant function - it improves the type-safety for those that type this option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@emotion/native': patch | ||
'@emotion/styled': patch | ||
--- | ||
|
||
`FilteringStyledOptions` and `StyledOptions` types no longer require a type argument for the `Props` generic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
// TypeScript Version: 2.1 | ||
|
||
declare function isPropValid(string: PropertyKey): boolean | ||
declare function isPropValid(prop: string): boolean | ||
export default isPropValid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters