Skip to content

Commit 8c5209e

Browse files
Luis Fernando Alvarez Dtimneutkens
Luis Fernando Alvarez D
authored andcommitted
Update typescript examples (vercel#7867)
* Updated with-jest-typescript * Updated the mobx-state-tree-typescript example * Removed the sitemap with typescript example * Updated the with css typings example
1 parent 24fa6b3 commit 8c5209e

37 files changed

+90
-554
lines changed
+1-27
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
11
{
2-
"env": {
3-
"development": {
4-
"presets": [
5-
"next/babel",
6-
"@zeit/next-typescript/babel"
7-
]
8-
},
9-
"production": {
10-
"presets": [
11-
"next/babel",
12-
"@zeit/next-typescript/babel"
13-
]
14-
},
15-
"test": {
16-
"presets": [
17-
[
18-
"next/babel",
19-
{
20-
"preset-env": {
21-
"modules": "commonjs"
22-
}
23-
}
24-
],
25-
"@zeit/next-typescript/babel"
26-
]
27-
}
28-
}
2+
"presets": ["next/babel"]
293
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

examples/with-jest-typescript/next.config.js

-2
This file was deleted.

examples/with-jest-typescript/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
},
1515
"devDependencies": {
1616
"@types/jest": "^24.0.11",
17-
"@types/next": "^8.0.1",
1817
"@types/react": "^16.8.8",
1918
"@types/react-dom": "^16.8.2",
20-
"@zeit/next-typescript": "^1.1.1",
2119
"babel-core": "^6.26.3",
2220
"babel-jest": "^24.5.0",
2321
"enzyme": "^3.9.0",

examples/with-jest-typescript/pages/cars.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import CarsOverview from './../src/modules/cars/Overview'
1+
import CarsOverview from '../src/modules/cars/Overview'
22

33
const CarsPage = () => <CarsOverview />
44

examples/with-jest-typescript/pages/login.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Login from './../src/modules/auth/Login'
1+
import Login from '../src/modules/auth/Login'
22

33
const LoginPage = () => <Login />
44

examples/with-jest-typescript/src/modules/cars/Overview.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react'
33
import * as T from './types'
44

55
export interface CarsOverviewProps {
6-
cars: T.CarList
6+
cars?: T.CarList
77
}
88

99
export interface CarsOverviewState {
@@ -26,7 +26,7 @@ export default class CarsOverview extends React.Component<
2626
this.setState({ selectedCar: car })
2727
}
2828

29-
renderCarsList = (cars: T.CarList): JSX.Element => {
29+
renderCarsList = (cars?: T.CarList): JSX.Element => {
3030
if (!cars || cars.length === 0) {
3131
return <p>No cars</p>
3232
}

examples/with-jest-typescript/tsconfig.json

+19-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,31 @@
1414
"sourceMap": true,
1515
"skipLibCheck": true,
1616
"baseUrl": ".",
17-
"typeRoots": ["./node_modules/@types"],
18-
"lib": ["dom", "es2015", "es2016"]
17+
"typeRoots": [
18+
"./node_modules/@types"
19+
],
20+
"lib": [
21+
"dom",
22+
"es2015",
23+
"es2016"
24+
],
25+
"strict": false,
26+
"forceConsistentCasingInFileNames": true,
27+
"noEmit": true,
28+
"esModuleInterop": true,
29+
"resolveJsonModule": true,
30+
"isolatedModules": true
1931
},
2032
"exclude": [
2133
"node_modules",
2234
"**/*.spec.ts",
2335
"**/*.spec.tsx",
2436
"**/*.test.ts",
2537
"**/*.test.tsx"
38+
],
39+
"include": [
40+
"next-env.d.ts",
41+
"**/*.ts",
42+
"**/*.tsx"
2643
]
2744
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"presets": [
3-
"next/babel",
4-
"@zeit/next-typescript/babel"
5-
],
6-
"plugins": [
7-
["@babel/plugin-proposal-decorators", { "legacy": true }]
8-
]
2+
"presets": ["next/babel"],
3+
"plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]]
94
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

examples/with-mobx-state-tree-typescript/next.config.js

-2
This file was deleted.

examples/with-mobx-state-tree-typescript/package.json

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
"scripts": {
55
"dev": "next",
66
"build": "next build",
7-
"start": "next start",
8-
"tslint": "tslint -c tslint.json -p tsconfig.json"
7+
"start": "next start"
98
},
109
"dependencies": {
11-
"@zeit/next-typescript": "1.1.0",
1210
"mobx": "^5.9.0",
1311
"mobx-react": "^5.4.3",
1412
"mobx-state-tree": "^3.11.0",
@@ -18,13 +16,8 @@
1816
"typescript": "^3.0.1"
1917
},
2018
"devDependencies": {
21-
"@types/next": "^6.1.4",
22-
"@types/react": "^16.4.12",
2319
"@babel/plugin-proposal-decorators": "^7.3.0",
24-
"tslint": "^5.9.1",
25-
"tslint-config-standard": "^7.0.0",
26-
"tslint-loader": "^3.5.3",
27-
"tslint-react": "^3.4.0"
20+
"@types/react": "^16.4.12"
2821
},
2922
"license": "ISC"
3023
}

examples/with-mobx-state-tree-typescript/stores/store.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export type IStoreSnapshotOut = SnapshotOut<typeof Store>
4141

4242
export const initializeStore = (isServer, snapshot = null) => {
4343
if (isServer) {
44-
store = Store.create({ foo: 6, lastUpdate: Date.now() })
44+
store = Store.create({ foo: 6, lastUpdate: Date.now(), light: false })
4545
}
4646
if ((store as any) === null) {
47-
store = Store.create({ foo: 6, lastUpdate: Date.now() })
47+
store = Store.create({ foo: 6, lastUpdate: Date.now(), light: false })
4848
}
4949
if (snapshot) {
5050
applySnapshot(store, snapshot)
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
2-
"compileOnSave": false,
32
"compilerOptions": {
4-
"experimentalDecorators": true,
5-
"target": "esnext",
6-
"module": "esnext",
7-
"jsx": "preserve",
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
85
"allowJs": true,
9-
"moduleResolution": "node",
10-
"allowSyntheticDefaultImports": true,
11-
"noImplicitThis": true,
12-
"noUnusedLocals": true,
13-
"noUnusedParameters": true,
14-
"strictNullChecks": true,
15-
"removeComments": false,
16-
"preserveConstEnums": true,
17-
"sourceMap": true,
186
"skipLibCheck": true,
19-
"baseUrl": ".",
20-
"typeRoots": ["./node_modules/@types"],
21-
"lib": ["dom", "es2015", "es2016"]
22-
}
7+
"strict": false,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"jsx": "preserve",
16+
"experimentalDecorators": true
17+
},
18+
"exclude": ["node_modules"],
19+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
2320
}

examples/with-mobx-state-tree-typescript/tslint.json

-44
This file was deleted.

examples/with-sitemap-and-robots-express-server-typescript/.babelrc

-6
This file was deleted.

examples/with-sitemap-and-robots-express-server-typescript/.gitignore

-16
This file was deleted.

examples/with-sitemap-and-robots-express-server-typescript/.npmignore

-10
This file was deleted.

examples/with-sitemap-and-robots-express-server-typescript/README.md

-75
This file was deleted.

examples/with-sitemap-and-robots-express-server-typescript/now.json

-12
This file was deleted.

0 commit comments

Comments
 (0)