diff --git a/templates/AngularSpa/tsconfig.json b/templates/AngularSpa/tsconfig.json index 939be48..4a6a371 100644 --- a/templates/AngularSpa/tsconfig.json +++ b/templates/AngularSpa/tsconfig.json @@ -1,11 +1,14 @@ { "compilerOptions": { + "module": "es2015", "moduleResolution": "node", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "skipDefaultLibCheck": true, + "skipLibCheck": true, // Workaround for https://github.com/angular/angular/issues/17863. Remove this if you upgrade to a fixed version of Angular. + "strict": true, "lib": [ "es6", "dom" ], "types": [ "webpack-env" ] }, diff --git a/templates/AureliaSpa/tsconfig.json b/templates/AureliaSpa/tsconfig.json index b60045f..bcbfa21 100644 --- a/templates/AureliaSpa/tsconfig.json +++ b/templates/AureliaSpa/tsconfig.json @@ -1,11 +1,13 @@ { "compilerOptions": { + "module": "es2015", "moduleResolution": "node", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "skipDefaultLibCheck": true, + "strict": true, "lib": [ "es2015", "dom" ], "types": [ "webpack-env" ] }, diff --git a/templates/KnockoutSpa/ClientApp/boot.ts b/templates/KnockoutSpa/ClientApp/boot.ts index 5edafc0..833ec8e 100644 --- a/templates/KnockoutSpa/ClientApp/boot.ts +++ b/templates/KnockoutSpa/ClientApp/boot.ts @@ -1,9 +1,9 @@ import './css/site.css'; import 'bootstrap'; import * as ko from 'knockout'; +import { createBrowserHistory } from 'history'; import './webpack-component-loader'; import AppRootComponent from './components/app-root/app-root'; -import { createBrowserHistory } from 'history'; const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!; const basename = baseUrl.substring(0, baseUrl.length - 1); // History component needs no trailing slash diff --git a/templates/KnockoutSpa/ClientApp/router.ts b/templates/KnockoutSpa/ClientApp/router.ts index ca35465..6131750 100644 --- a/templates/KnockoutSpa/ClientApp/router.ts +++ b/templates/KnockoutSpa/ClientApp/router.ts @@ -1,7 +1,7 @@ import * as ko from 'knockout'; import * as $ from 'jquery'; import * as History from 'history'; -import crossroads = require('crossroads'); +import * as crossroads from 'crossroads'; // This module configures crossroads.js, a routing library. If you prefer, you // can use any other routing library (or none at all) as Knockout is designed to @@ -20,7 +20,7 @@ export class Router { // Reset and configure Crossroads so it matches routes and updates this.currentRoute crossroads.removeAllRoutes(); crossroads.resetState(); - crossroads.normalizeFn = crossroads.NORM_AS_OBJECT; + (crossroads as any).normalizeFn = crossroads.NORM_AS_OBJECT; routes.forEach(route => { crossroads.addRoute(route.url, (requestParams: any) => { this.currentRoute(ko.utils.extend(requestParams, route.params)); diff --git a/templates/KnockoutSpa/npm-shrinkwrap.json b/templates/KnockoutSpa/npm-shrinkwrap.json index 1c2e723..290db88 100644 --- a/templates/KnockoutSpa/npm-shrinkwrap.json +++ b/templates/KnockoutSpa/npm-shrinkwrap.json @@ -21,9 +21,9 @@ "dev": true }, "@types/history": { - "version": "2.0.48", - "from": "@types/history@>=2.0.38 <3.0.0", - "resolved": "https://registry.npmjs.org/@types/history/-/history-2.0.48.tgz", + "version": "4.6.0", + "from": "@types/history@4.6.0", + "resolved": "https://registry.npmjs.org/@types/history/-/history-4.6.0.tgz", "dev": true }, "@types/jquery": { @@ -38,18 +38,6 @@ "resolved": "https://registry.npmjs.org/@types/knockout/-/knockout-3.4.41.tgz", "dev": true }, - "@types/react": { - "version": "15.0.31", - "from": "@types/react@*", - "resolved": "https://registry.npmjs.org/@types/react/-/react-15.0.31.tgz", - "dev": true - }, - "@types/react-router": { - "version": "2.0.50", - "from": "@types/react-router@>=2.0.37 <3.0.0", - "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-2.0.50.tgz", - "dev": true - }, "@types/signals": { "version": "0.0.16", "from": "@types/signals@0.0.16", diff --git a/templates/KnockoutSpa/package.json b/templates/KnockoutSpa/package.json index 8943465..64f132d 100644 --- a/templates/KnockoutSpa/package.json +++ b/templates/KnockoutSpa/package.json @@ -9,7 +9,6 @@ "@types/history": "^4.6.0", "@types/jquery": "^2.0.32", "@types/knockout": "^3.4.41", - "@types/react-router": "^2.0.37", "@types/signals": "0.0.16", "@types/webpack-env": "^1.13.0", "aspnet-webpack": "^2.0.1", diff --git a/templates/KnockoutSpa/tsconfig.json b/templates/KnockoutSpa/tsconfig.json index 7f4f8df..78973bd 100644 --- a/templates/KnockoutSpa/tsconfig.json +++ b/templates/KnockoutSpa/tsconfig.json @@ -1,9 +1,11 @@ { "compilerOptions": { + "module": "es2015", "moduleResolution": "node", "target": "es5", "sourceMap": true, "skipDefaultLibCheck": true, + "strict": true, "types": ["es6-promise", "webpack-env"] }, "exclude": [ diff --git a/templates/ReactReduxSpa/ClientApp/store/WeatherForecasts.ts b/templates/ReactReduxSpa/ClientApp/store/WeatherForecasts.ts index 6af905c..ea79d9f 100644 --- a/templates/ReactReduxSpa/ClientApp/store/WeatherForecasts.ts +++ b/templates/ReactReduxSpa/ClientApp/store/WeatherForecasts.ts @@ -60,7 +60,7 @@ export const actionCreators = { // ---------------- // REDUCER - For a given state and action, returns the new state. To support time travel, this must not mutate the old state. -const unloadedState: WeatherForecastsState = { startDateIndex: undefined, forecasts: [], isLoading: false }; +const unloadedState: WeatherForecastsState = { forecasts: [], isLoading: false }; export const reducer: Reducer = (state: WeatherForecastsState, incomingAction: Action) => { const action = incomingAction as KnownAction; diff --git a/templates/ReactReduxSpa/tsconfig.json b/templates/ReactReduxSpa/tsconfig.json index 0a2eb67..7909f2d 100644 --- a/templates/ReactReduxSpa/tsconfig.json +++ b/templates/ReactReduxSpa/tsconfig.json @@ -1,21 +1,16 @@ { "compilerOptions": { "baseUrl": ".", + "module": "es2015", "moduleResolution": "node", "target": "es5", "jsx": "react", "experimentalDecorators": true, "sourceMap": true, "skipDefaultLibCheck": true, + "strict": true, "lib": ["es6", "dom"], - "types": [ "webpack-env" ], - "paths": { - // Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions. - // We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them). - "history": ["./node_modules/@types/history/index"], - "redux": ["./node_modules/@types/redux/index"], - "react": ["./node_modules/@types/react/index"] - } + "types": ["webpack-env"] }, "exclude": [ "bin", diff --git a/templates/ReactSpa/ClientApp/components/Counter.tsx b/templates/ReactSpa/ClientApp/components/Counter.tsx index ef51b16..4532857 100644 --- a/templates/ReactSpa/ClientApp/components/Counter.tsx +++ b/templates/ReactSpa/ClientApp/components/Counter.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; interface CounterState { currentCount: number; } -export class Counter extends React.Component<{}, CounterState> { +export class Counter extends React.Component, CounterState> { constructor() { super(); this.state = { currentCount: 0 }; diff --git a/templates/ReactSpa/ClientApp/components/FetchData.tsx b/templates/ReactSpa/ClientApp/components/FetchData.tsx index c958ea6..ce191bd 100644 --- a/templates/ReactSpa/ClientApp/components/FetchData.tsx +++ b/templates/ReactSpa/ClientApp/components/FetchData.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; import 'isomorphic-fetch'; interface FetchDataExampleState { @@ -6,7 +7,7 @@ interface FetchDataExampleState { loading: boolean; } -export class FetchData extends React.Component<{}, FetchDataExampleState> { +export class FetchData extends React.Component, FetchDataExampleState> { constructor() { super(); this.state = { forecasts: [], loading: true }; diff --git a/templates/ReactSpa/ClientApp/components/Home.tsx b/templates/ReactSpa/ClientApp/components/Home.tsx index 76d8d04..e9ce1f2 100644 --- a/templates/ReactSpa/ClientApp/components/Home.tsx +++ b/templates/ReactSpa/ClientApp/components/Home.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; -export class Home extends React.Component<{}, {}> { +export class Home extends React.Component, {}> { public render() { return

Hello, world!

diff --git a/templates/ReactSpa/tsconfig.json b/templates/ReactSpa/tsconfig.json index cd7432a..ed53101 100644 --- a/templates/ReactSpa/tsconfig.json +++ b/templates/ReactSpa/tsconfig.json @@ -1,18 +1,14 @@ { "compilerOptions": { "baseUrl": ".", + "module": "es2015", "moduleResolution": "node", "target": "es5", "jsx": "react", "sourceMap": true, "skipDefaultLibCheck": true, - "types": [ "webpack-env" ], - "paths": { - // Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions. - // We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them). - "history": ["./node_modules/@types/history/index"], - "react": ["./node_modules/@types/react/index"] - } + "strict": true, + "types": ["webpack-env"] }, "exclude": [ "bin", diff --git a/templates/VueSpa/tsconfig.json b/templates/VueSpa/tsconfig.json index 04827d0..b523b75 100644 --- a/templates/VueSpa/tsconfig.json +++ b/templates/VueSpa/tsconfig.json @@ -7,6 +7,7 @@ "target": "es5", "sourceMap": true, "skipDefaultLibCheck": true, + "strict": true, "types": ["webpack-env"] }, "exclude": [