Skip to content

Commit 124cfcc

Browse files
renovate[bot]renovate-botwardpeet
authored
fix(deps): update typescript (#31152)
* fix(deps): update typescript * update typinges * reset file * remove dummy typescript deps * fix redux stypes Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Ward Peeters <[email protected]>
1 parent 53e5991 commit 124cfcc

File tree

26 files changed

+165
-242
lines changed

26 files changed

+165
-242
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"@types/signal-exit": "^3.0.0",
2828
"@types/stack-trace": "^0.0.29",
2929
"@types/webpack-merge": "^4.1.5",
30-
"@typescript-eslint/eslint-plugin": "^4.14.2",
31-
"@typescript-eslint/parser": "^4.22.0",
30+
"@typescript-eslint/eslint-plugin": "^4.28.1",
31+
"@typescript-eslint/parser": "^4.28.1",
3232
"babel-jest": "^24.9.0",
3333
"chalk": "^4.1.1",
3434
"chokidar": "^3.5.1",
@@ -88,7 +88,7 @@
8888
"rimraf": "^3.0.2",
8989
"svgo": "1.3.2",
9090
"ts-jest": "^22",
91-
"typescript": "^4.1.5",
91+
"typescript": "^4.3.5",
9292
"unified": "^9.2.0",
9393
"yargs": "^15.4.1"
9494
},

packages/create-gatsby/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"string-length": "^4.0.2",
3636
"terminal-link": "^2.1.1",
3737
"tiny-spin": "^1.0.2",
38-
"typescript": "^4.1.5",
3938
"uuid": "3.4.0"
4039
},
4140
"repository": {

packages/gatsby-admin/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"@feedback-fish/react": "^1.2.1",
1717
"@types/react-instantsearch-dom": "^5.2.6",
1818
"@types/socket.io-client": "^1.4.35",
19-
"@typescript-eslint/eslint-plugin": "^4.14.2",
20-
"@typescript-eslint/parser": "^4.14.2",
19+
"@typescript-eslint/eslint-plugin": "^4.28.1",
20+
"@typescript-eslint/parser": "^4.28.1",
2121
"csstype": "^2.6.14",
2222
"formik": "^2.2.6",
2323
"gatsby": "^3.10.0-next.2",
@@ -45,7 +45,6 @@
4545
"strict-ui": "^0.2.0-0",
4646
"subscriptions-transport-ws": "^0.9.18",
4747
"theme-ui": "^0.4.0-rc.14",
48-
"typescript": "^4.1.5",
4948
"urql": "^1.11.6",
5049
"yup": "^0.32.8"
5150
},

packages/gatsby-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"rollup": "^2.34.2",
7070
"rollup-plugin-auto-external": "^2.0.0",
7171
"rollup-plugin-internal": "^1.0.0",
72-
"typescript": "^4.1.5"
72+
"typescript": "^4.3.5"
7373
},
7474
"files": [
7575
"lib/",

packages/gatsby-cli/src/reporter/redux/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { createStore, combineReducers } from "redux"
1+
import { createStore, combineReducers, Store } from "redux"
22
import { reducer } from "./reducer"
3-
import { ActionsUnion, ISetLogs } from "./types"
3+
import { ActionsUnion, ISetLogs, IGatsbyCLIState } from "./types"
44
import { isInternalAction } from "./utils"
55
import { createStructuredLoggingDiagnosticsMiddleware } from "./diagnostics"
66
import { Actions } from "../constants"
77

8-
let store = createStore(
8+
let store: Store<{ logs: IGatsbyCLIState }> = createStore(
99
combineReducers({
1010
logs: reducer,
1111
}),

packages/gatsby-core-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@types/ci-info": "2.0.0",
4545
"babel-preset-gatsby-package": "^1.10.0-next.0",
4646
"cross-env": "^7.0.3",
47-
"typescript": "^4.1.5"
47+
"typescript": "^4.3.5"
4848
},
4949
"engines": {
5050
"node": ">=12.13.0"

packages/gatsby-page-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"babel-preset-gatsby-package": "^1.10.0-next.0",
3939
"cross-env": "^7.0.3",
4040
"rimraf": "^3.0.2",
41-
"typescript": "^4.1.5"
41+
"typescript": "^4.3.5"
4242
},
4343
"files": [
4444
"dist/"

packages/gatsby-plugin-image/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"npm-run-all": "^4.1.5",
6262
"postcss": "^8.2.9",
6363
"terser": "^5.3.8",
64-
"typescript": "^4.1.5"
64+
"typescript": "^4.3.5"
6565
},
6666
"peerDependencies": {
6767
"@babel/core": "^7.12.3",

packages/gatsby-plugin-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"babel-preset-gatsby-package": "^1.10.0-next.0",
3030
"cross-env": "^7.0.3",
3131
"rimraf": "^3.0.2",
32-
"typescript": "^4.1.5"
32+
"typescript": "^4.3.5"
3333
},
3434
"peerDependencies": {
3535
"gatsby": "^3.0.0-next.0"

packages/gatsby-source-shopify/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"prettier": "^2.2.1",
3737
"prettier-check": "^2.0.0",
3838
"tsc-watch": "^4.2.9",
39-
"typescript": "^4.2.3"
39+
"typescript": "^4.3.5"
4040
},
4141
"peerDependencies": {
4242
"gatsby-plugin-image": "^1.1.0"

packages/gatsby-telemetry/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"jest-cli": "^24.9.0",
3333
"jest-junit": "^6.4.0",
3434
"rimraf": "^3.0.2",
35-
"typescript": "^4.1.5"
35+
"typescript": "^4.3.5"
3636
},
3737
"files": [
3838
"lib/",

packages/gatsby-worker/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"babel-preset-gatsby-package": "^1.10.0-next.0",
1616
"cross-env": "^7.0.3",
1717
"rimraf": "^3.0.2",
18-
"typescript": "^4.1.5"
18+
"typescript": "^4.3.5"
1919
},
2020
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-worker#readme",
2121
"keywords": [

packages/gatsby/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"@nodelib/fs.walk": "^1.2.4",
2323
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
2424
"@types/http-proxy": "^1.17.4",
25-
"@typescript-eslint/eslint-plugin": "^4.15.2",
26-
"@typescript-eslint/parser": "^4.15.2",
25+
"@typescript-eslint/eslint-plugin": "^4.28.1",
26+
"@typescript-eslint/parser": "^4.28.1",
2727
"address": "1.1.2",
2828
"anser": "^2.0.1",
2929
"autoprefixer": "^10.2.4",
@@ -184,7 +184,7 @@
184184
"react": "^16.12.0",
185185
"react-dom": "^16.12.0",
186186
"rimraf": "^3.0.2",
187-
"typescript": "^4.1.5",
187+
"typescript": "^4.3.5",
188188
"xhr-mock": "^2.5.1",
189189
"zipkin": "^0.22.0",
190190
"zipkin-javascript-opentracing": "^3.0.0",

packages/gatsby/src/bootstrap/__tests__/remove-stale-jobs.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe(`remove-stale-jobs`, () => {
3131

3232
isJobStale.mockReturnValue(true)
3333

34-
expect(removeStaleJobs(state)).toMatchSnapshot()
34+
expect(removeStaleJobs(state.jobsV2)).toMatchSnapshot()
3535
expect(internalActions.removeStaleJob).toHaveBeenCalledTimes(1)
3636
expect(internalActions.removeStaleJob).toHaveBeenCalledWith(`1234`)
3737
expect(internalActions.createJobV2FromInternalJob).not.toHaveBeenCalled()
@@ -50,7 +50,7 @@ describe(`remove-stale-jobs`, () => {
5050

5151
isJobStale.mockReturnValue(true)
5252

53-
expect(removeStaleJobs(state)).toMatchSnapshot()
53+
expect(removeStaleJobs(state.jobsV2)).toMatchSnapshot()
5454
expect(internalActions.removeStaleJob).toHaveBeenCalledTimes(1)
5555
expect(internalActions.removeStaleJob).toHaveBeenCalledWith(`1234`)
5656
expect(internalActions.createJobV2FromInternalJob).not.toHaveBeenCalled()
@@ -72,7 +72,7 @@ describe(`remove-stale-jobs`, () => {
7272
// we need it to return a promise so createJobV2FromInternalJob action creator works correctly
7373
enqueueJob.mockReturnValue(Promise.resolve({ result: true }))
7474

75-
const toDispatch = removeStaleJobs(state)
75+
const toDispatch = removeStaleJobs(state.jobsV2)
7676
const dispatchedActions = []
7777
for (const actionOrThunk of toDispatch) {
7878
if (typeof actionOrThunk === `function`) {

packages/gatsby/src/bootstrap/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import { globalTracer } from "opentracing"
1717
import type { GatsbyWorkerPool } from "../utils/worker/pool"
1818
import { handleStalePageData } from "../utils/page-data"
1919
import { saveStateForWorkers } from "../redux"
20+
import { IProgram } from "../commands/types"
2021

2122
const tracer = globalTracer()
2223

2324
export async function bootstrap(
24-
initialContext: Partial<IBuildContext>
25+
initialContext: Partial<IBuildContext> & { program: IProgram }
2526
): Promise<{
2627
gatsbyNodeGraphQLFunction: Runner
2728
workerPool: GatsbyWorkerPool

packages/gatsby/src/bootstrap/load-plugins/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from "lodash"
22

33
import { store } from "../../redux"
4+
import { IGatsbyState } from "../../redux/types"
45
import * as nodeAPIs from "../../utils/api-node-docs"
56
import * as browserAPIs from "../../utils/api-browser-docs"
67
import ssrAPIs from "../../../cache-dir/api-ssr-docs"
@@ -122,7 +123,7 @@ export async function loadPlugins(
122123
// If we get this far, everything looks good. Update the store
123124
store.dispatch({
124125
type: `SET_SITE_FLATTENED_PLUGINS`,
125-
payload: flattenedPlugins,
126+
payload: flattenedPlugins as IGatsbyState["flattenedPlugins"],
126127
})
127128

128129
// And let plugins initialize if they want to

packages/gatsby/src/bootstrap/remove-stale-jobs.ts

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
import {
22
IGatsbyState,
3-
IRemoveStaleJobAction,
3+
IRemoveStaleJobV2Action,
44
ICreateJobV2FromInternalAction,
5-
IGatsbyIncompleteJobV2,
6-
IGatsbyCompleteJobV2,
75
} from "../redux/types"
86

97
import { isJobStale } from "../utils/jobs-manager"
108
import { internalActions } from "../redux/actions"
119

1210
export const removeStaleJobs = (
13-
state: IGatsbyState
14-
): Array<IRemoveStaleJobAction | ICreateJobV2FromInternalAction> => {
11+
jobs: IGatsbyState["jobsV2"]
12+
): Array<IRemoveStaleJobV2Action | ICreateJobV2FromInternalAction> => {
1513
const actions: Array<
16-
IRemoveStaleJobAction | ICreateJobV2FromInternalAction
14+
IRemoveStaleJobV2Action | ICreateJobV2FromInternalAction
1715
> = []
1816

1917
// If any of our finished jobs are stale we remove them to keep our cache small
20-
state.jobsV2.complete.forEach(
21-
(job: IGatsbyCompleteJobV2, contentDigest: string): void => {
22-
if (isJobStale(job)) {
23-
actions.push(internalActions.removeStaleJob(contentDigest))
24-
}
18+
jobs.complete.forEach((job, contentDigest) => {
19+
if (isJobStale(job)) {
20+
actions.push(internalActions.removeStaleJob(contentDigest))
2521
}
26-
)
22+
})
2723

2824
// If any of our pending jobs do not have an existing inputPath or the inputPath changed
2925
// we remove it from the queue as they would fail anyway
30-
state.jobsV2.incomplete.forEach(({ job }: IGatsbyIncompleteJobV2): void => {
26+
jobs.incomplete.forEach(({ job }): void => {
3127
if (isJobStale(job)) {
3228
actions.push(internalActions.removeStaleJob(job.contentDigest))
3329
} else {

packages/gatsby/src/commands/build-html.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from "fs-extra"
33
import reporter from "gatsby-cli/lib/reporter"
44
import { createErrorFromString } from "gatsby-cli/lib/reporter/errors"
55
import { chunk } from "lodash"
6-
import webpack from "webpack"
6+
import webpack, { Stats } from "webpack"
77
import * as path from "path"
88

99
import { emitter, store } from "../redux"
@@ -59,7 +59,7 @@ const runWebpack = (
5959
directory,
6060
parentSpan?: Span
6161
): Bluebird<{
62-
stats: webpack.Stats | undefined
62+
stats: Stats
6363
waitForCompilerClose: Promise<void>
6464
}> =>
6565
new Bluebird((resolve, reject) => {
@@ -91,7 +91,7 @@ const runWebpack = (
9191
if (err) {
9292
return reject(err)
9393
} else {
94-
return resolve({ stats, waitForCompilerClose })
94+
return resolve({ stats: stats as Stats, waitForCompilerClose })
9595
}
9696
})
9797
} else if (
@@ -126,7 +126,10 @@ const runWebpack = (
126126

127127
oldHash = newHash
128128

129-
return resolve({ stats, waitForCompilerClose: Promise.resolve() })
129+
return resolve({
130+
stats: stats as Stats,
131+
waitForCompilerClose: Promise.resolve(),
132+
})
130133
}
131134
}
132135
) as IWebpackWatchingPauseResume
@@ -145,17 +148,17 @@ const doBuildRenderer = async (
145148
directory,
146149
parentSpan
147150
)
148-
if (stats?.hasErrors()) {
151+
if (stats.hasErrors()) {
149152
reporter.panic(structureWebpackErrors(stage, stats.compilation.errors))
150153
}
151154

152155
if (
153156
stage === `build-html` &&
154-
store.getState().html.ssrCompilationHash !== stats?.hash
157+
store.getState().html.ssrCompilationHash !== stats.hash
155158
) {
156159
store.dispatch({
157160
type: `SET_SSR_WEBPACK_COMPILATION_HASH`,
158-
payload: stats?.hash,
161+
payload: stats.hash as string,
159162
})
160163
}
161164

packages/gatsby/src/redux/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
DeepPartial,
66
Middleware,
77
ReducersMapObject,
8+
Store,
89
} from "redux"
910
import _ from "lodash"
1011
import telemetry from "gatsby-telemetry"
@@ -78,7 +79,9 @@ const multi: Middleware<IMultiDispatch> = ({ dispatch }) => next => (
7879
// We're using the inferred type here because manually typing it would be very complicated
7980
// and error-prone. Instead we'll make use of the createStore return value, and export that type.
8081
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
81-
export const configureStore = (initialState: IGatsbyState) =>
82+
export const configureStore = (
83+
initialState: IGatsbyState
84+
): Store<IGatsbyState> =>
8285
createStore(
8386
combineReducers<IGatsbyState>({ ...reducers }),
8487
initialState,

packages/gatsby/src/redux/reducers/jobsv2.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import {
2-
ActionsUnion,
2+
ICreateJobV2Action,
3+
IRemoveStaleJobV2Action,
4+
IEndJobV2Action,
35
IGatsbyState,
46
IGatsbyIncompleteJobV2,
57
IGatsbyCompleteJobV2,
8+
IDeleteCacheAction,
69
} from "../types"
710

811
const initialState = (): IGatsbyState["jobsV2"] => {
@@ -14,11 +17,17 @@ const initialState = (): IGatsbyState["jobsV2"] => {
1417

1518
export const jobsV2Reducer = (
1619
state = initialState(),
17-
action: ActionsUnion
20+
action:
21+
| ICreateJobV2Action
22+
| IRemoveStaleJobV2Action
23+
| IEndJobV2Action
24+
| IDeleteCacheAction
1825
): IGatsbyState["jobsV2"] => {
1926
switch (action.type) {
2027
case `DELETE_CACHE`:
21-
return action.cacheIsCorrupt ? initialState() : state
28+
return (action as IDeleteCacheAction).cacheIsCorrupt
29+
? initialState()
30+
: state
2231

2332
case `CREATE_JOB_V2`: {
2433
const { job } = action.payload

packages/gatsby/src/redux/reducers/program.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const initialState: IStateProgram = {
1313
host: `localhost`,
1414
sitePackageJson: {},
1515
extensions: [],
16+
browserslist: [],
1617
report: reporter,
1718
}
1819

packages/gatsby/src/redux/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ type BabelStageKeys =
179179

180180
export interface IStateProgram extends IProgram {
181181
extensions: Array<string>
182+
browserslist: Array<string>
182183
}
183184

184185
export interface IQueryState {
@@ -401,6 +402,7 @@ export type ActionsUnion =
401402
| IGeneratedHtml
402403
| IMarkHtmlDirty
403404
| ISSRUsedUnsafeBuiltin
405+
| ISetSiteConfig
404406

405407
export interface IApiFinishedAction {
406408
type: `API_FINISHED`

0 commit comments

Comments
 (0)