React Redux Template does not work with typescript@next #208

Closed
opened 2025-08-09 17:15:25 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @ILL35T on 1/26/2018

React Redux Template does not work with the latest typescript.
VS2017 > File > New > React Redux SPA Template
Change typescript version in package.json to: "typescript": "^2.8.0-dev.20180126"

Project fails to build and produces the following errors:

ERROR in [at-loader] ./ClientApp/components/Counter.tsx:31:3
TS2345: Argument of type 'typeof Counter' is not assignable to parameter of type 'Component'.
Type 'typeof Counter' is not assignable to type 'StatelessComponent'.
Type 'typeof Counter' provides no match for the signature '(props: CounterState & { children?: ReactNode; }, context?: any): ReactElement | null'.
ERROR in [at-loader] ./ClientApp/components/FetchData.tsx:73:3
TS2345: Argument of type 'typeof FetchData' is not assignable to parameter of type 'Component'.
Type 'typeof FetchData' is not assignable to type 'StatelessComponent'.
Type 'typeof FetchData' provides no match for the signature '(props: WeatherForecastsState & { children?: ReactNode; }, context?: any): ReactElement | null'.
ERROR in [at-loader] ./ClientApp/configureStore.ts:20:19
TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures.
ERROR in [at-loader] ./ClientApp/routes.tsx:10:12
TS2322: Type '{ path: string; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Rea...'.
Type '{ path: string; component: typeof Counter; }' is not assignable to type 'Readonly'.
Types of property 'component' are incompatible.
Type 'typeof Counter' is not assignable to type 'StatelessComponent<RouteComponentProps | undefined> | ComponentClass<RouteComponentProps<any...'.
Type 'typeof Counter' is not assignable to type 'ComponentClass<RouteComponentProps | undefined>'.
Types of parameters 'props' and 'props' are incompatible.
Type 'RouteComponentProps | undefined' is not assignable to type 'CounterProps | undefined'.
Type 'RouteComponentProps' is not assignable to type 'CounterProps | undefined'.
Type 'RouteComponentProps' is not assignable to type 'CounterProps'.
Type 'RouteComponentProps' is not assignable to type 'CounterState'.
Property 'count' is missing in type 'RouteComponentProps'.
ERROR in [at-loader] ./ClientApp/routes.tsx:11:12
TS2322: Type '{ path: string; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Rea...'.
Type '{ path: string; component: typeof FetchData; }' is not assignable to type 'Readonly'.
Types of property 'component' are incompatible.
Type 'typeof FetchData' is not assignable to type 'StatelessComponent<RouteComponentProps | undefined> | ComponentClass<RouteComponentProps<any...'.
Type 'typeof FetchData' is not assignable to type 'ComponentClass<RouteComponentProps | undefined>'.
Types of parameters 'props' and 'props' are incompatible.
Type 'RouteComponentProps | undefined' is not assignable to type 'WeatherForecastProps | undefined'.
Type 'RouteComponentProps' is not assignable to type 'WeatherForecastProps | undefined'.
Type 'RouteComponentProps' is not assignable to type 'WeatherForecastProps'.
Type 'RouteComponentProps' is not assignable to type 'WeatherForecastsState'.
Property 'isLoading' is missing in type 'RouteComponentProps'.
ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:109:81
TS2344: Type 'ChangeTargetHTMLAttributes' does not satisfy the constraint 'DOMAttributes'.
Types of property 'onChange' are incompatible.
Type 'EventHandler<ChangeEvent> | undefined' is not assignable to type 'EventHandler<FormEvent> | undefined'.
Type 'EventHandler<ChangeEvent>' is not assignable to type 'EventHandler<FormEvent> | undefined'.
Type 'EventHandler<ChangeEvent>' is not assignable to type 'EventHandler<FormEvent>'.
Types of parameters 'event' and 'event' are incompatible.
Type 'FormEvent' is not assignable to type 'ChangeEvent'.
Types of property 'target' are incompatible.
Type 'EventTarget' is not assignable to type 'EventTarget & T'.
Type 'EventTarget' is not assignable to type 'T'.
ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:2479:15
TS2430: Interface 'ChangeTargetHTMLAttributes' incorrectly extends interface 'HTMLAttributes'.
Types of property 'onChange' are incompatible.
Type 'EventHandler<ChangeEvent> | undefined' is not assignable to type 'EventHandler<FormEvent> | undefined'.
Type 'EventHandler<ChangeEvent>' is not assignable to type 'EventHandler<FormEvent> | undefined'.
Type 'EventHandler<ChangeEvent>' is not assignable to type 'EventHandler<FormEvent>'.
Types of parameters 'event' and 'event' are incompatible.
Type 'FormEvent' is not assignable to type 'ChangeEvent'.
Types of property 'target' are incompatible.
Type 'EventTarget' is not assignable to type 'EventTarget & T'.
Type 'EventTarget' is not assignable to type 'T'.

*Originally created by @ILL35T on 1/26/2018* React Redux Template does not work with the latest typescript. VS2017 > File > New > React Redux SPA Template Change typescript version in package.json to: "typescript": "^2.8.0-dev.20180126" Project fails to build and produces the following errors: > ERROR in [at-loader] ./ClientApp/components/Counter.tsx:31:3 TS2345: Argument of type 'typeof Counter' is not assignable to parameter of type 'Component<CounterState>'. Type 'typeof Counter' is not assignable to type 'StatelessComponent<CounterState>'. Type 'typeof Counter' provides no match for the signature '(props: CounterState & { children?: ReactNode; }, context?: any): ReactElement<any> | null'. ERROR in [at-loader] ./ClientApp/components/FetchData.tsx:73:3 TS2345: Argument of type 'typeof FetchData' is not assignable to parameter of type 'Component<WeatherForecastsState>'. Type 'typeof FetchData' is not assignable to type 'StatelessComponent<WeatherForecastsState>'. Type 'typeof FetchData' provides no match for the signature '(props: WeatherForecastsState & { children?: ReactNode; }, context?: any): ReactElement<any> | null'. ERROR in [at-loader] ./ClientApp/configureStore.ts:20:19 TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. ERROR in [at-loader] ./ClientApp/routes.tsx:10:12 TS2322: Type '{ path: string; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route> & Readonly<{ children?: ReactNode; }> & Rea...'. Type '{ path: string; component: typeof Counter; }' is not assignable to type 'Readonly<RouteProps>'. Types of property 'component' are incompatible. Type 'typeof Counter' is not assignable to type 'StatelessComponent<RouteComponentProps<any> | undefined> | ComponentClass<RouteComponentProps<any...'. Type 'typeof Counter' is not assignable to type 'ComponentClass<RouteComponentProps<any> | undefined>'. Types of parameters 'props' and 'props' are incompatible. Type 'RouteComponentProps<any> | undefined' is not assignable to type 'CounterProps | undefined'. Type 'RouteComponentProps<any>' is not assignable to type 'CounterProps | undefined'. Type 'RouteComponentProps<any>' is not assignable to type 'CounterProps'. Type 'RouteComponentProps<any>' is not assignable to type 'CounterState'. Property 'count' is missing in type 'RouteComponentProps<any>'. ERROR in [at-loader] ./ClientApp/routes.tsx:11:12 TS2322: Type '{ path: string; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route> & Readonly<{ children?: ReactNode; }> & Rea...'. Type '{ path: string; component: typeof FetchData; }' is not assignable to type 'Readonly<RouteProps>'. Types of property 'component' are incompatible. Type 'typeof FetchData' is not assignable to type 'StatelessComponent<RouteComponentProps<any> | undefined> | ComponentClass<RouteComponentProps<any...'. Type 'typeof FetchData' is not assignable to type 'ComponentClass<RouteComponentProps<any> | undefined>'. Types of parameters 'props' and 'props' are incompatible. Type 'RouteComponentProps<any> | undefined' is not assignable to type 'WeatherForecastProps | undefined'. Type 'RouteComponentProps<any>' is not assignable to type 'WeatherForecastProps | undefined'. Type 'RouteComponentProps<any>' is not assignable to type 'WeatherForecastProps'. Type 'RouteComponentProps<any>' is not assignable to type 'WeatherForecastsState'. Property 'isLoading' is missing in type 'RouteComponentProps<any>'. ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:109:81 TS2344: Type 'ChangeTargetHTMLAttributes<T>' does not satisfy the constraint 'DOMAttributes<T>'. Types of property 'onChange' are incompatible. Type 'EventHandler<ChangeEvent<T>> | undefined' is not assignable to type 'EventHandler<FormEvent<T>> | undefined'. Type 'EventHandler<ChangeEvent<T>>' is not assignable to type 'EventHandler<FormEvent<T>> | undefined'. Type 'EventHandler<ChangeEvent<T>>' is not assignable to type 'EventHandler<FormEvent<T>>'. Types of parameters 'event' and 'event' are incompatible. Type 'FormEvent<T>' is not assignable to type 'ChangeEvent<T>'. Types of property 'target' are incompatible. Type 'EventTarget' is not assignable to type 'EventTarget & T'. Type 'EventTarget' is not assignable to type 'T'. ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:2479:15 TS2430: Interface 'ChangeTargetHTMLAttributes<T>' incorrectly extends interface 'HTMLAttributes<T>'. Types of property 'onChange' are incompatible. Type 'EventHandler<ChangeEvent<T>> | undefined' is not assignable to type 'EventHandler<FormEvent<T>> | undefined'. Type 'EventHandler<ChangeEvent<T>>' is not assignable to type 'EventHandler<FormEvent<T>> | undefined'. Type 'EventHandler<ChangeEvent<T>>' is not assignable to type 'EventHandler<FormEvent<T>>'. Types of parameters 'event' and 'event' are incompatible. Type 'FormEvent<T>' is not assignable to type 'ChangeEvent<T>'. Types of property 'target' are incompatible. Type 'EventTarget' is not assignable to type 'EventTarget & T'. Type 'EventTarget' is not assignable to type 'T'.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#208
No description provided.