Skip to content

Commit

Permalink
Document withStyles overloads (#8364)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelotom authored and oliviertassinari committed Sep 24, 2017
1 parent 65b6e04 commit a1fa0d2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/styles/withStyles.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ export default function withStyles<Names extends string>(
style: StyleRules<Names> | StyleRulesCallback<Names>,
options?: WithStylesOptions
): {
/**
* Decorating a stateless functional component.
*/
<P>(
component: React.StatelessComponent<P & WithStyles<Names>>
): React.ComponentType<P & StyledComponentProps<Names>>;

/**
* Decorating a class component. This is slightly less type safe than the
* function decoration case, due to current restrictions on TypeScript
* decorators (https://github.com/Microsoft/TypeScript/issues/4881). The
* upshot is that one has to use the non-null assertion operator (`!`) when
* accessing `props.classes`.
*/
<P, C extends React.ComponentClass<P & StyledComponentProps<Names>>>(
component: C
): C;
Expand Down

0 comments on commit a1fa0d2

Please sign in to comment.