Open kryops opened 3 years ago
For me, that doesn't work completely with *.tsx
files.
After compilation - propTypes
object is absent.
The better solution I found:
MyComponent['propTypes'] = { ... };
@kryops I just randomly found this, but shouldn't it be static propTypes = {};
, not with a :
?
@rpearce that would be the workaround.
The above code is however valid TypeScript, first only declaring the member and its type, then assigning its value later. When migrating our codebase to TypeScript, this was the minimal change required to make TypeScript happy about the prop types.
Code (TypeScript):
Config:
throws the error