React-jss doesn't ignores defaultProps in Typescript
- Dominant language
- JavaScript
- Stars
- 7.1k
- Forks
- 386
- PR merge metrics
- No merged PRs in 30d
Description
__Expected behavior:__
Typescript 3.0 added [support for defaultProps](https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#support-for-defaultprops-in-jsx) in React.
Using `WithStyles` seems to break this behavior.
__Describe the bug:__
Props are reported as required even though they are defaulted using a `public static defaultProps` field.
__Codesandbox link:__
The following code should do it but I can't make it work in CodeSandbox. For some reason, it keeps marking `React` as `any` which can't trigger the error.
Here is the url anyway: https://codesandbox.io/s/fk93m
```ts
import * as React from "react";
import { render } from "react-dom";
import injectSheet, { WithStyles } from "react-jss";
const styles = {
blue: {
color: "blue"
}
};
interface IProps extends WithStyles {
count: number;
}
class App extends React.Component {
public static defaultProps = {
//count: 18 // Enabling this line triggers a type error when Using RealApp below
};
public render() {
const { classes, count } = this.props;
return
}
}
const RealApp = injectSheet(styles)(App);
render(, document.getElementById("root"));
```
__Versions (please complete the following information):__
- react-jss: ^10.0.0-alpha.16.
- Browser: Chrome but error is due to typings.
- OS: Windows
- Typescript: 3.4.3
Contributor guide
Assessment
This issue has not been assessed yet.