-
-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit applies changes to ensure the `createUseStyles` hook has accurate TS intellisense for props and themes. The details of the work may be found below. Note: Changes are for TypeScript files **only**. Minimal changes were applied in order to minimize regression testing and the potential for cascading negative effects. General: * Updated .eslintignore to ignore TSX type tests in addition to TS type tests. JSS: * `Style` now expects type parameters for `Props` and `Theme`. * `JssStyle` now expects type parameters for `Props` and `Theme`. * `Func` now expects type parameters for `Props` and `Theme`. * Types are arranged to prevent unnecessary/confusing parameter shadowing. Once a function in a style object is introduced, if the function returns an object, none of the returned object's properties (or nested properties) may define a function that has access to `Props` or `Theme`. * Updated tests for `Styles` type. * Where necessary for the compiler, updated other types (mainly for `createStyleSheet` and `StyleSheet`. * Includes minor automated changes. React-JSS: * `createUseStyles` now expects type parameters for `Props` and `Theme`. * `data` in `useStyles` now expects the proper typed argument (`Props` with an optional `Theme`.) * Types are arranged to prevent unnecessary/confusing parameter shadowing. If the argument to `createUseStyles` is a function of `Theme`, then no properties (or nested properties) in the object that the function returns are permitted to define functions with access to `Theme`. * Updated types for `withStyles` (and related types) to be compatible with new changes. * Added several typed tests for `createUseStyles` and `withStyles` to ensure that everything behaves as expected.
- Loading branch information
1 parent
b0510be
commit ea195bf
Showing
6 changed files
with
481 additions
and
31 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ flow-typed/ | |
packages/**/dist/ | ||
examples/**/static/ | ||
*.ts | ||
*.tsx |
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
Oops, something went wrong.