mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Enable TS strict mode in all templates and generally clean up TS references
This commit is contained in:
@@ -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<RouteComponentProps<{}>, CounterState> {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = { currentCount: 0 };
|
||||
|
||||
@@ -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<RouteComponentProps<{}>, FetchDataExampleState> {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = { forecasts: [], loading: true };
|
||||
|
||||
@@ -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<RouteComponentProps<{}>, {}> {
|
||||
public render() {
|
||||
return <div>
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user