chore(*): upgrade to TypeScript 4.0 (#736)

* chore(*): upgrade to TypeScript 4.0

* Fix

* Fix

* trigger

* build

* More fixes

* Fix
This commit is contained in:
Nathan Bierema 2021-06-16 12:20:20 -04:00 committed by GitHub
parent 81916f6cb8
commit 698fdec21d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 16 deletions

View File

@ -42,7 +42,7 @@
"stylelint-processor-styled-components": "^1.10.0", "stylelint-processor-styled-components": "^1.10.0",
"ts-jest": "^26.2.0", "ts-jest": "^26.2.0",
"ts-node": "^9.0.0", "ts-node": "^9.0.0",
"typescript": "^3.9.7", "typescript": "~4.0.7",
"url-loader": "^4.1.0", "url-loader": "^4.1.0",
"webpack": "^4.44.1", "webpack": "^4.44.1",
"webpack-cli": "^3.3.12", "webpack-cli": "^3.3.12",

View File

@ -157,7 +157,7 @@ const getStylingByKeys = (
.map((key) => mergedStyling[key as string]) .map((key) => mergedStyling[key as string])
.filter(Boolean); .filter(Boolean);
const props = styles.reduce( const props = styles.reduce<Styling>(
(obj, s) => { (obj, s) => {
if (typeof s === 'string') { if (typeof s === 'string') {
obj.className = [obj.className, s].filter(Boolean).join(' '); obj.className = [obj.className, s].filter(Boolean).join(' ');
@ -176,7 +176,7 @@ const getStylingByKeys = (
delete props.className; delete props.className;
} }
if (Object.keys(props.style).length === 0) { if (Object.keys(props.style!).length === 0) {
delete props.style; delete props.style;
} }

View File

@ -2,8 +2,8 @@ import { Base16Theme } from 'base16';
import * as CSS from 'csstype'; import * as CSS from 'csstype';
export interface Styling { export interface Styling {
className: string; className?: string;
style: CSS.Properties<string | number>; style?: CSS.Properties<string | number>;
} }
export type StylingValueFunction = ( export type StylingValueFunction = (

View File

@ -127,14 +127,14 @@ test('createStyling (custom)', () => {
testClass: 'customClass', testClass: 'customClass',
testStyle: { height: 0 }, testStyle: { height: 0 },
testFunc: (styling: Styling, arg: string) => ({ testFunc: (styling: Styling, arg: string) => ({
className: `${styling.className} customClass--${arg}`, className: `${styling.className!} customClass--${arg}`,
style: { style: {
...styling.style, ...styling.style,
border: 0, border: 0,
}, },
}), }),
testFuncNoStyle: (styling: Styling, arg: string) => ({ testFuncNoStyle: (styling: Styling, arg: string) => ({
className: `${styling.className} customClass--${arg}`, className: `${styling.className!} customClass--${arg}`,
style: { style: {
...styling.style, ...styling.style,
border: 0, border: 0,

View File

@ -1141,6 +1141,8 @@ describe('instrument', () => {
const importMonitoredLiftedStore = importMonitoredStore.liftedStore; const importMonitoredLiftedStore = importMonitoredStore.liftedStore;
const noComputedExportedState = Object.assign({}, exportedState); const noComputedExportedState = Object.assign({}, exportedState);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete noComputedExportedState.computedStates; delete noComputedExportedState.computedStates;
importMonitoredLiftedStore.dispatch( importMonitoredLiftedStore.dispatch(
@ -1184,6 +1186,8 @@ describe('instrument', () => {
state: LiftedState<S, A, null> state: LiftedState<S, A, null>
) { ) {
state.actionsById = _.mapValues(state.actionsById, (action) => { state.actionsById = _.mapValues(state.actionsById, (action) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete action.timestamp; delete action.timestamp;
delete action.stack; delete action.stack;
return action; return action;

View File

@ -3,6 +3,8 @@ import { compose, createStore } from 'redux';
describe('persistState', () => { describe('persistState', () => {
const savedLocalStorage = global.localStorage; const savedLocalStorage = global.localStorage;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage; delete global.localStorage;
beforeEach(() => { beforeEach(() => {
@ -119,6 +121,8 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => { const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop // noop
}); });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage.getItem; delete global.localStorage.getItem;
createStore(reducer, compose(instrument(), persistState('id'))); createStore(reducer, compose(instrument(), persistState('id')));
@ -133,6 +137,8 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => { const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop // noop
}); });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage.setItem; delete global.localStorage.setItem;
const store = createStore( const store = createStore(
reducer, reducer,

View File

@ -21305,7 +21305,7 @@ fsevents@^1.2.7:
stylelint-processor-styled-components: ^1.10.0 stylelint-processor-styled-components: ^1.10.0
ts-jest: ^26.2.0 ts-jest: ^26.2.0
ts-node: ^9.0.0 ts-node: ^9.0.0
typescript: ^3.9.7 typescript: ~4.0.7
url-loader: ^4.1.0 url-loader: ^4.1.0
webpack: ^4.44.1 webpack: ^4.44.1
webpack-cli: ^3.3.12 webpack-cli: ^3.3.12
@ -23947,23 +23947,23 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
typescript@^3.9.7: "typescript@patch:typescript@~4.0.7#builtin<compat/typescript>":
version: 3.9.7 version: 4.0.7
resolution: "typescript@npm:3.9.7" resolution: "typescript@patch:typescript@npm%3A4.0.7#builtin<compat/typescript>::version=4.0.7&hash=ddfc1b"
bin: bin:
tsc: bin/tsc tsc: bin/tsc
tsserver: bin/tsserver tsserver: bin/tsserver
checksum: 10848a9c35fd8c70a8792b8bd9485317534bcd58768793d3b7d9c7486e9fd30cf345f83fa2a324e0bf6088bc8a4d8d061d58fda38b18c2ff187cf01fbbff6267 checksum: f234923fbef722077d00ee008aa3492b02adbfe5a67b1c31687a0f7c6cb9946b759665ea643ffc1174298ffb1c59de0cc2abe1a91e57415d51951589eff12446
languageName: node languageName: node
linkType: hard linkType: hard
"typescript@patch:typescript@^3.9.7#builtin<compat/typescript>": typescript@~4.0.7:
version: 3.9.7 version: 4.0.7
resolution: "typescript@patch:typescript@npm%3A3.9.7#builtin<compat/typescript>::version=3.9.7&hash=ddfc1b" resolution: "typescript@npm:4.0.7"
bin: bin:
tsc: bin/tsc tsc: bin/tsc
tsserver: bin/tsserver tsserver: bin/tsserver
checksum: ee9b64dafd9997a7f659c402dc4500792e05724a39a9071a0b79fd513466d6f4497e7d4963e092804a387b77e9cb9d4bfe365433fcbf2ca9eea44476ba3df14d checksum: 1b4c63a228efd6ceec80382b6001dad2c27c9bd46022f965dab907a13275c9ceb7b4b4de8be8902457bd644d2b0f9ddd8cf03b561e35d7cd2d793cf7554afd2d
languageName: node languageName: node
linkType: hard linkType: hard