You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Changes required for compiling in strict mode #1098
EDIT: This issue has nothing to do with projects generated using the template throwing errors while running webpack. For a solution to that problem see #1099.
Even though I'm not sure if TypeScript's strict should be activated by default, I think that the templates should at least compile when a user decides to enable strict mode.
At the moment the ReactRedux template throws a few issues:
./ClientApp/boot-client.tsx:5:30 TS7016: Could not find a declaration file for module 'react-hot-loader'.
./ClientApp/configureStore.ts:15:51 TS7006: Parameter 'f' implicitly has an 'any' type.
./ClientApp/configureStore.ts:33:27 TS7006: Parameter 'allReducers' implicitly has an 'any' type.
./ClientApp/store/WeatherForecasts.ts:63:7 TS2322: Type '{ startDateIndex: null; forecasts: never[]; isLoading: false; }' is not assignable to type 'WeatherForecastsState'. Types of property 'startDateIndex' are incompatible. Type 'null' is not assignable to type 'number'.
All of these issues can be fixed with just small modifications. Should I create a PR?
Even with strict mode turned off, I get these errors:
ERROR in [at-loader] ./ClientApp/routes.tsx:9:12
TS2322: Type '{ exact: true; path: "/"; component: typeof Home; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
Type '{ exact: true; path: "/"; component: typeof Home; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./ClientApp/routes.tsx:10:12
TS2322: Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./ClientApp/routes.tsx:11:12
TS2322: Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'Readonly<T>'.
These errors are independent from strict mode, therefore it would be better to create a new issue on github (see #1099). However I can confirm that these errors arise when creating a new project via yo.
i don't face any issues while running restore or npm install however, when I run the application these are errors I get.
ERROR in [at-loader] ./ClientApp/routes.tsx:10:12
TS2322: Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
Type '{ path: "/counter"; component: typeof Counter; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./ClientApp/routes.tsx:11:12
TS2322: Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
Type '{ path: "/fetchdata/:startDateIndex?"; component: typeof FetchData; }' is not assignable to type 'Readonly<T>'.
ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:67:21
TS2694: Namespace 'React' has no exported member 'ComponentType'.
ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:102:48
TS2694: Namespace 'React' has no exported member 'ComponentType'.
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 4.08 kB [entry] [rendered]
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[1] ./~/css-loader!./ClientApp/css/site.css 1.82 kB {0} [built]
Thanks @stephtr for the pull request. That's now merged, so this issue is fixed.
Also, strict mode is now enabled in all the templates by default. I can't think of much of a reason people would want to avoid that, but if they do, it's much easier to turn off than to turn on.
Activity
mcquiggd commentedon Jul 8, 2017
Even with strict mode turned off, I get these errors:
stephtr commentedon Jul 8, 2017
These errors are independent from strict mode,
therefore it would be better to create a new issue on github(see #1099). However I can confirm that these errors arise when creating a new project viayo.varunpsr commentedon Jul 12, 2017
i don't face any issues while running restore or npm install however, when I run the application these are errors I get.
`
[-]ReactRedux template doesn't compile in strict mode[/-][+]Changes required for compiling in strict mode[/+]stephtr commentedon Jul 12, 2017
As I mentioned that has nothing to do with this issue. In #1099 a temporary workaround has been posted:
Update your
package.jsonfile to:Afterwards you just have to restore the packages, then the ReactRedux template should work again.
SteveSandersonMS commentedon Jul 13, 2017
Thanks @stephtr for the pull request. That's now merged, so this issue is fixed.
Also,
strictmode is now enabled in all the templates by default. I can't think of much of a reason people would want to avoid that, but if they do, it's much easier to turn off than to turn on.varunpsr commentedon Jul 13, 2017
Awesome, thank you! 👍