我最近将所有反应库更新为最新版本及其所有类型。我面临打字稿编译的问题。它是在说
[ts] Type '{ history: History<any>; location: Location<any>; match: match<any>; staticContext?: StaticContext; }' is not assignable to type 'LibraryManagedAttributes<T["component"], Readonly<{ children?: ReactNode; }> & Readonly<{ history: History<any>; location: Location<any>; match: match<any>; staticContext?: StaticContext; }>>'. [2322]
Run Code Online (Sandbox Code Playgroud)
type PrivateRouteProps = UserAuthStore.UserAuthState &
typeof UserAuthStore.actionCreators &
RouteProps &
{ component: typeof React.Component };
class PrivateRoute<T extends PrivateRouteProps = PrivateRouteProps> extends React.Component<T, {}> {
render() {
let auth = new Auth();
const {
isAuthenticated,
component: Component,
...props
} = this.props
if (!isAuthenticated) {
console.log(this.props) …Run Code Online (Sandbox Code Playgroud) abstract class A {
abstract void method();
}
class B extends A {
B() {
}
void method() {
}
}
class C extends B {
C() {
}
}
Run Code Online (Sandbox Code Playgroud)
当我在 main 中实例化类 C 时,它会自动调用 B(父类)的构造函数。这是正常现象还是我做错了什么?