From a635c4bc6a7889a8c917129c1c10e6b174a442f2 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Fri, 18 Jun 2021 03:00:59 +0000 Subject: [PATCH] chore(*): upgrade to TypeScript 4.2 (#740) * chore(*): upgrade to TypeScript 4.2 * Fix * Ignore --- package.json | 2 +- .../react-json-tree/src/JSONNestedNode.tsx | 7 +++---- .../monitors/InspectorWrapper/index.tsx | 1 + .../src/openFile.ts | 2 +- packages/redux-devtools-utils/src/filters.ts | 16 ++++++++++------ yarn.lock | 18 +++++++++--------- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 73eb57ef..44d1a66f 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "stylelint-processor-styled-components": "^1.10.0", "ts-jest": "^26.2.0", "ts-node": "^9.0.0", - "typescript": "~4.1.6", + "typescript": "~4.2.4", "url-loader": "^4.1.0", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", diff --git a/packages/react-json-tree/src/JSONNestedNode.tsx b/packages/react-json-tree/src/JSONNestedNode.tsx index 9df427e8..e678af6c 100644 --- a/packages/react-json-tree/src/JSONNestedNode.tsx +++ b/packages/react-json-tree/src/JSONNestedNode.tsx @@ -103,10 +103,9 @@ interface State { function getStateFromProps(props: Props) { // calculate individual node expansion if necessary - const expanded = - props.shouldExpandNode && !props.isCircular - ? props.shouldExpandNode(props.keyPath, props.data, props.level) - : false; + const expanded = !props.isCircular + ? props.shouldExpandNode(props.keyPath, props.data, props.level) + : false; return { expanded, }; diff --git a/packages/redux-devtools-app/src/containers/monitors/InspectorWrapper/index.tsx b/packages/redux-devtools-app/src/containers/monitors/InspectorWrapper/index.tsx index 78d45c98..940024f0 100644 --- a/packages/redux-devtools-app/src/containers/monitors/InspectorWrapper/index.tsx +++ b/packages/redux-devtools-app/src/containers/monitors/InspectorWrapper/index.tsx @@ -34,6 +34,7 @@ interface Props { } class InspectorWrapper extends Component { + // eslint-disable-next-line @typescript-eslint/unbound-method static update = InspectorMonitor.update; render() { diff --git a/packages/redux-devtools-inspector-monitor-trace-tab/src/openFile.ts b/packages/redux-devtools-inspector-monitor-trace-tab/src/openFile.ts index bbf11a91..c01272dc 100644 --- a/packages/redux-devtools-inspector-monitor-trace-tab/src/openFile.ts +++ b/packages/redux-devtools-inspector-monitor-trace-tab/src/openFile.ts @@ -127,7 +127,7 @@ export default function openFile( if ( chrome.devtools && chrome.devtools.panels && - chrome.devtools.panels.openResource + !!chrome.devtools.panels.openResource ) { openResource(fileName, lineNumber, stackFrame); } else if (chrome.runtime && (chrome.runtime.openOptionsPage || isFF)) { diff --git a/packages/redux-devtools-utils/src/filters.ts b/packages/redux-devtools-utils/src/filters.ts index e3f3eb00..2b3d2ca5 100644 --- a/packages/redux-devtools-utils/src/filters.ts +++ b/packages/redux-devtools-utils/src/filters.ts @@ -20,7 +20,7 @@ export function arrToRegex(v: string | string[]) { function filterActions( actionsById: { [actionId: number]: PerformAction> }, - actionsFilter: (action: Action, id: number) => Action + actionsFilter: ((action: Action, id: number) => Action) | undefined ) { if (!actionsFilter) return actionsById; return mapValues(actionsById, (action, id: number) => ({ @@ -127,7 +127,9 @@ export function filterState( type: string, localFilter: LocalFilter, stateSanitizer: (state: unknown, actionId: number) => unknown, - actionSanitizer: (action: Action, id: number) => Action, + actionSanitizer: + | ((action: Action, id: number) => Action) + | undefined, nextActionId: number, predicate: (currState: unknown, currAction: Action) => boolean ) { @@ -146,9 +148,11 @@ export function filterState( state: unknown; error?: string | undefined; }[] = []; - const sanitizedActionsById: { - [id: number]: PerformAction>; - } = actionSanitizer && {}; + const sanitizedActionsById: + | { + [id: number]: PerformAction>; + } + | undefined = actionSanitizer && {}; const { actionsById } = state; const { computedStates } = state; @@ -169,7 +173,7 @@ export function filterState( : liftedState ); if (actionSanitizer) { - sanitizedActionsById[id] = { + sanitizedActionsById![id] = { ...liftedAction, action: actionSanitizer(currAction, id), }; diff --git a/yarn.lock b/yarn.lock index d21064c7..5acddf07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21305,7 +21305,7 @@ fsevents@^1.2.7: stylelint-processor-styled-components: ^1.10.0 ts-jest: ^26.2.0 ts-node: ^9.0.0 - typescript: ~4.1.6 + typescript: ~4.2.4 url-loader: ^4.1.0 webpack: ^4.44.1 webpack-cli: ^3.3.12 @@ -23947,23 +23947,23 @@ fsevents@^1.2.7: languageName: node linkType: hard -"typescript@patch:typescript@~4.1.6#builtin": - version: 4.1.6 - resolution: "typescript@patch:typescript@npm%3A4.1.6#builtin::version=4.1.6&hash=ddfc1b" +"typescript@patch:typescript@~4.2.4#builtin": + version: 4.2.4 + resolution: "typescript@patch:typescript@npm%3A4.2.4#builtin::version=4.2.4&hash=ddfc1b" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 12e2121f1dd538030ec829e6d5ed8205c256f3b22269744140676deace23b559aa67d143676761a1780c14f70f16953d8ae850a344bee2f7d915e0bf6ca6943e + checksum: 64658fdf27872904641dcaacf925e6b5a52fb4aa4881a5a726fc78a11b76748423ce9e996dac42313729321061c4dd38a06108014f8d07b222dcff2687037186 languageName: node linkType: hard -typescript@~4.1.6: - version: 4.1.6 - resolution: "typescript@npm:4.1.6" +typescript@~4.2.4: + version: 4.2.4 + resolution: "typescript@npm:4.2.4" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 36cdaf5d69fe096d3644d01f163a62c9469065e23867e2d732f83a85e97e67a32644407bebb36e46d8bcc2c5c57d4b7a07f0701b591af038a5984b58a0664566 + checksum: edaede2fa77f56b7fba80ee624a2368ab1216e75b0434d968ccb47ab0a5e2f6d94f848b3b111c1237dd71e988cd376af26370dcdad3b94355c76e759f0dd0a1e languageName: node linkType: hard