Skip to content

Commit 5a9dd72

Browse files
committed
chore(typescript): support typescript@v4.4.2
1 parent 1b6d0dc commit 5a9dd72

File tree

15 files changed

+390
-431
lines changed

15 files changed

+390
-431
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@
5050
},
5151
"homepage": "https://react-md.dev",
5252
"devDependencies": {
53-
"@babel/plugin-transform-typescript": "^7.15.0",
54-
"@mlaursen/eslint-config": "^1.1.4",
53+
"@babel/plugin-transform-typescript": "^7.15.4",
54+
"@mlaursen/eslint-config": "^1.1.5",
5555
"@testing-library/dom": "^8.1.0",
5656
"@testing-library/jest-dom": "^5.14.1",
5757
"@testing-library/react": "^12.0.0",
5858
"@testing-library/react-hooks": "^7.0.1",
5959
"@testing-library/user-event": "13.2.1",
6060
"@types/fs-extra": "^9.0.12",
6161
"@types/glob": "^7.1.4",
62-
"@types/jest": "^27.0.0",
62+
"@types/jest": "^27.0.1",
6363
"@types/lodash": "^4.14.172",
6464
"@types/node": "^15.14.7",
6565
"@types/prettier": "^2.3.2",
@@ -86,8 +86,8 @@
8686
"react-dom": "^17.0.1",
8787
"react-test-renderer": "^17.0.2",
8888
"sass-lint": "^1.13.1",
89-
"ts-jest": "^27.0.4",
90-
"typescript": "^4.3.5"
89+
"ts-jest": "^27.0.5",
90+
"typescript": "^4.4.2"
9191
},
9292
"lint-staged": {
9393
"**/*.{ts,tsx,scss,js,jsx,md,yml,json}": [

packages/dev-utils/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"watch": "npm-run-all -p \"compile -w\" watcher"
1616
},
1717
"dependencies": {
18-
"@babel/core": "^7.15.0",
18+
"@babel/core": "^7.15.5",
1919
"@octokit/core": "^3.5.1",
2020
"chokidar": "^3.5.2",
2121
"commander": "^8.1.0",
@@ -40,10 +40,10 @@
4040
"rimraf": "^3.0.2",
4141
"sass": "^1.37.5",
4242
"sassdoc": "^2.7.2",
43-
"ts-morph": "^11.0.3",
44-
"typedoc": "^0.21.5",
43+
"ts-morph": "^12.0.0",
44+
"typedoc": "^0.21.9",
4545
"typedoc-plugin-sourcefile-url": "^1.0.6",
46-
"typescript": "^4.3.5"
46+
"typescript": "^4.4.2"
4747
},
4848
"devDependencies": {
4949
"@types/cssnano": "^4.0.1",

packages/dev-utils/src/sassdoc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ ${data}`;
130130
log.error(`path: ${path}`);
131131
log.error(`name: ${name}`);
132132
log.error();
133-
log.error(e.message);
133+
if (e instanceof Error) {
134+
log.error(e.message);
135+
}
134136
process.exit(1);
135137
}
136138
}

packages/dev-utils/src/utils/styles/variable.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ ${getEverythingScss()}
208208
log.error(`value: ${originalValue}`);
209209
log.error("");
210210

211-
log.error(e.message);
211+
if (e instanceof Error) {
212+
log.error(e.message);
213+
}
212214
process.exit(1);
213215
}
214216

@@ -232,7 +234,7 @@ ${getEverythingScss()}
232234
log.error(`Unable to parse the map: ${name}`);
233235
log.error(`index is: "${index}"`);
234236
log.error(compiledValue);
235-
if ("message" in e) {
237+
if (e instanceof Error) {
236238
log.error(e.message);
237239
}
238240
process.exit(1);

packages/documentation/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"sass": "^1.37.5"
4545
},
4646
"devDependencies": {
47-
"@babel/core": "^7.15.0",
47+
"@babel/core": "^7.15.5",
4848
"@react-md/dev-utils": "^3.0.0",
4949
"@types/formidable": "^1.2.3",
5050
"@types/gtag.js": "^0.0.7",
@@ -59,7 +59,7 @@
5959
"eslint-config-next": "^11.1.0",
6060
"npm-run-all": "^4.1.5",
6161
"raw-loader": "^4.0.2",
62-
"typescript": "^4.3.5",
62+
"typescript": "^4.4.2",
6363
"webpack": "^5.50.0"
6464
},
6565
"browerlist": [

packages/documentation/src/utils/tests.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/export */
12
/* eslint-disable @typescript-eslint/no-empty-function */
23
import React, { ReactElement, ReactNode } from "react";
34
import { RouterContext } from "next/dist/shared/lib/router-context";

packages/form/src/file-input/useFileUpload.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ export function useFileUpload<E extends HTMLElement, CustomError = never>({
390390
dispatch({
391391
type: "queue",
392392
files: [],
393-
errors: [new FileAccessError(e)],
393+
errors: [
394+
new FileAccessError(e instanceof Error ? e.message : undefined),
395+
],
394396
});
395397
}
396398
},
@@ -410,7 +412,9 @@ export function useFileUpload<E extends HTMLElement, CustomError = never>({
410412
dispatch({
411413
type: "queue",
412414
files: [],
413-
errors: [new FileAccessError(e)],
415+
errors: [
416+
new FileAccessError(e instanceof Error ? e.message : undefined),
417+
],
414418
});
415419
}
416420
},

packages/utils/src/events/touches.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export function setTouchEvent(
3535
*/
3636
options?: AddEventListenerOptions
3737
): void {
38-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
39-
// @ts-expect-error
4038
el[`${add ? "add" : "remove"}EventListener`](
4139
`touch${eventType}`,
40+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
41+
// @ts-expect-error
4242
callback,
4343
isSupported ? { passive: true, capture, ...options } : capture
4444
);

packages/utils/src/positioning/__tests__/createHorizonalPosition.ts

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,29 @@ import {
1414
getLeftCoord,
1515
getRightCoord,
1616
} from "../getCoord";
17-
import { HorizontalPosition } from "../types";
1817

19-
const containerRect1: ClientRect = {
18+
const containerRect1: DOMRect = {
2019
left: 100,
2120
right: 50,
2221
top: 25,
2322
bottom: 75,
2423
height: 200,
2524
width: 100,
25+
x: 100,
26+
y: 25,
27+
toJSON() {},
2628
};
2729

28-
const containerRect2: ClientRect = {
30+
const containerRect2: DOMRect = {
2931
left: 50,
3032
right: 100,
3133
top: 75,
3234
bottom: 25,
3335
height: 100,
3436
width: 200,
37+
x: 200,
38+
y: 75,
39+
toJSON() {},
3540
};
3641
const config1: FixConfig = {
3742
xMargin: 0,
@@ -83,10 +88,13 @@ const leftBoundsConfig1: FixConfig = {
8388
// pretending an icon button
8489
height: 40,
8590
width: 40,
91+
x: 0,
92+
y: 0,
93+
toJSON() {},
8694
},
8795
};
8896
const leftBoundsConfig2: FixConfig = { ...leftBoundsConfig1, vwMargin: 8 };
89-
const rightBoundsConfig1 = {
97+
const rightBoundsConfig1: FixConfig = {
9098
xMargin: 0,
9199
vwMargin: 0,
92100
elWidth: 475,
@@ -101,9 +109,12 @@ const rightBoundsConfig1 = {
101109
// pretending an icon button
102110
height: 40,
103111
width: 40,
112+
x: vw - 40,
113+
y: 0,
114+
toJSON() {},
104115
},
105116
};
106-
const rightBoundsConfig2 = { ...rightBoundsConfig1, vwMargin: 8 };
117+
const rightBoundsConfig2: FixConfig = { ...rightBoundsConfig1, vwMargin: 8 };
107118

108119
describe("createAnchoredLeft", () => {
109120
it("should return the calcualted left coord and an actualX value of left", () => {
@@ -481,7 +492,7 @@ describe("createAnchoredRight", () => {
481492
});
482493

483494
it("should return the left coord as the left value if the position can be swapped within the viewport", () => {
484-
const config1 = {
495+
const config1: FixConfig = {
485496
xMargin: 0,
486497
vwMargin: 0,
487498
elWidth: 50,
@@ -494,9 +505,12 @@ describe("createAnchoredRight", () => {
494505
right: 0,
495506
height: 40,
496507
width: 40,
508+
x: 160,
509+
y: 0,
510+
toJSON() {},
497511
},
498512
};
499-
const config2 = { ...config1, xMargin: 8 };
513+
const config2: FixConfig = { ...config1, xMargin: 8 };
500514

501515
expect(createAnchoredRight(config2)).toEqual({
502516
left: getLeftCoord(config2),
@@ -507,7 +521,7 @@ describe("createAnchoredRight", () => {
507521

508522
describe("createEqualWidth", () => {
509523
const options1 = {
510-
x: "center" as HorizontalPosition,
524+
x: "center",
511525
vw: 1000,
512526
vwMargin: 0,
513527
xMargin: 0,
@@ -519,9 +533,12 @@ describe("createEqualWidth", () => {
519533
bottom: 200,
520534
height: 200,
521535
width: 400,
536+
x: 300,
537+
y: 0,
538+
toJSON() {},
522539
},
523540
isMinWidth: false,
524-
};
541+
} as const;
525542
const options2 = { ...options1, vwMargin: 16 };
526543
const options3 = { ...options1, xMargin: 5 };
527544
const options4 = { ...options2, xMargin: 5 };

packages/utils/src/positioning/__tests__/getCoord.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,28 @@ import {
1111
getTopCoord,
1212
} from "../getCoord";
1313

14-
const containerRect1: ClientRect = {
14+
const containerRect1: DOMRect = {
1515
left: 100,
1616
right: 50,
1717
top: 25,
1818
bottom: 75,
1919
height: 200,
2020
width: 100,
21+
x: 100,
22+
y: 25,
23+
toJSON() {},
2124
};
2225

23-
const containerRect2: ClientRect = {
26+
const containerRect2: DOMRect = {
2427
left: 50,
2528
right: 100,
2629
top: 75,
2730
bottom: 25,
2831
height: 100,
2932
width: 200,
33+
x: 60,
34+
y: 75,
35+
toJSON() {},
3036
};
3137

3238
describe("getLeftCoord", () => {

0 commit comments

Comments
 (0)