Types for Route class are wrong
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 795
- Forks
- 55
- Avg merge
- 5h 5m
- Merged PRs (30d)
- 2
Description
Types:
class Route extends React.Component<RouteProps> {}
Js code:
/**
* Convenience class for creating normal routes with JSX. When not using JSX,
* use a POJSO instead of this class.
*/
export default class Route {
constructor(props) {
Object.assign(this, props);
}
}
if (__DEV__) {
// Workaround to make React Proxy give me the original class, to allow
// makeRouteConfig to get the actual class, when using JSX for routes.
Route.prototype.isReactComponent = {};
}
Because of this, I can't extend this class:
class Foo extends Route {
render({ Component, props }) {
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the TypeScript Route declaration with the JavaScript Route class shown in the issue, then reproduce the type error when Foo extends Route. Done means the declaration permits that extension while preserving the existing RouteProps typing and route behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100