Use strict typescript compiler option

Changelog-entry: Use strict typescript compiler option
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-07-14 14:53:36 +02:00
parent 175e41de8d
commit 5eac622b8c
7 changed files with 52 additions and 23 deletions

View File

@ -125,10 +125,7 @@ const URLSelector = ({
cancel: () => void; cancel: () => void;
}) => { }) => {
const [imageURL, setImageURL] = React.useState(''); const [imageURL, setImageURL] = React.useState('');
const [recentImages, setRecentImages]: [ const [recentImages, setRecentImages] = React.useState<URL[]>([]);
URL[],
(value: React.SetStateAction<URL[]>) => void,
] = React.useState([]);
const [loading, setLoading] = React.useState(false); const [loading, setLoading] = React.useState(false);
React.useEffect(() => { React.useEffect(() => {
const fetchRecentUrlImages = async () => { const fetchRecentUrlImages = async () => {
@ -252,7 +249,7 @@ export class SourceSelector extends React.Component<
SourceSelectorProps, SourceSelectorProps,
SourceSelectorState SourceSelectorState
> { > {
private unsubscribe: () => void; private unsubscribe: (() => void) | undefined;
private afterSelected: SourceSelectorProps['afterSelected']; private afterSelected: SourceSelectorProps['afterSelected'];
constructor(props: SourceSelectorProps) { constructor(props: SourceSelectorProps) {
@ -282,7 +279,7 @@ export class SourceSelector extends React.Component<
} }
public componentWillUnmount() { public componentWillUnmount() {
this.unsubscribe(); this.unsubscribe?.();
ipcRenderer.removeListener('select-image', this.onSelectImage); ipcRenderer.removeListener('select-image', this.onSelectImage);
} }

View File

@ -161,7 +161,7 @@ export class TargetSelectorModal extends React.Component<
TargetSelectorModalProps, TargetSelectorModalProps,
TargetSelectorModalState TargetSelectorModalState
> { > {
unsubscribe: () => void; private unsubscribe: (() => void) | undefined;
tableColumns: Array<TableColumn<Target>>; tableColumns: Array<TableColumn<Target>>;
constructor(props: TargetSelectorModalProps) { constructor(props: TargetSelectorModalProps) {
@ -320,7 +320,7 @@ export class TargetSelectorModal extends React.Component<
} }
componentWillUnmount() { componentWillUnmount() {
this.unsubscribe(); this.unsubscribe?.();
} }
render() { render() {

View File

@ -213,7 +213,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
* writer.on('fail', onFail) * writer.on('fail', onFail)
*/ */
const onFail = ( const onFail = (
destination: sdk.sourceDestination.BlockDevice, destination: sdk.sourceDestination.SourceDestination,
error: Error, error: Error,
) => { ) => {
ipc.of[IPC_SERVER_ID].emit('fail', { ipc.of[IPC_SERVER_ID].emit('fail', {

View File

@ -17,11 +17,11 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
function createErrorDetails(options: { function createErrorDetails(options: {
title: string | ((error: Error) => string); title: string | ((error: Error & { path: string }) => string);
description: string | ((error: Error) => string); description: string;
}): { }): {
title: (error: Error) => string; title: (error: Error & { path: string }) => string;
description: (error: Error) => string; description: (error: Error & { path: string }) => string;
} { } {
return _.pick( return _.pick(
_.mapValues(options, (value) => { _.mapValues(options, (value) => {

42
npm-shrinkwrap.json generated
View File

@ -5443,6 +5443,7 @@
"requires": { "requires": {
"anymatch": "~3.1.1", "anymatch": "~3.1.1",
"braces": "~3.0.2", "braces": "~3.0.2",
"fsevents": "~2.1.1",
"glob-parent": "~5.1.0", "glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0", "is-binary-path": "~2.1.0",
"is-glob": "~4.0.1", "is-glob": "~4.0.1",
@ -8370,6 +8371,7 @@
"udif": "^0.17.0", "udif": "^0.17.0",
"unbzip2-stream": "github:balena-io-modules/unbzip2-stream#4a54f56a25b58950f9e4277c56db2912d62242e7", "unbzip2-stream": "github:balena-io-modules/unbzip2-stream#4a54f56a25b58950f9e4277c56db2912d62242e7",
"unzip-stream": "^0.3.0", "unzip-stream": "^0.3.0",
"winusb-driver-generator": "^1.2.3",
"xxhash": "^0.3.0", "xxhash": "^0.3.0",
"yauzl": "^2.9.2" "yauzl": "^2.9.2"
}, },
@ -9213,6 +9215,13 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true "dev": true
}, },
"fsevents": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
"dev": true,
"optional": true
},
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -11887,6 +11896,7 @@
"requires": { "requires": {
"anymatch": "~3.1.1", "anymatch": "~3.1.1",
"braces": "~3.0.2", "braces": "~3.0.2",
"fsevents": "~2.1.2",
"glob-parent": "~5.1.0", "glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0", "is-binary-path": "~2.1.0",
"is-glob": "~4.0.1", "is-glob": "~4.0.1",
@ -15898,9 +15908,9 @@
"dev": true "dev": true
}, },
"ts-loader": { "ts-loader": {
"version": "7.0.5", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.5.tgz", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-8.0.0.tgz",
"integrity": "sha512-zXypEIT6k3oTc+OZNx/cqElrsbBtYqDknf48OZos0NQ3RTt045fBIU8RRSu+suObBzYB355aIPGOe/3kj9h7Ig==", "integrity": "sha512-giEW167rtK1V6eX/DnXEtOgcawwoIp6hqznqYNNSmraUZOq36zMhwBq12JMlYhxf50BC58bscsTSKKtE42zAuw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.3.0", "chalk": "^2.3.0",
@ -16605,6 +16615,7 @@
"anymatch": "^2.0.0", "anymatch": "^2.0.0",
"async-each": "^1.0.1", "async-each": "^1.0.1",
"braces": "^2.3.2", "braces": "^2.3.2",
"fsevents": "^1.2.7",
"glob-parent": "^3.1.0", "glob-parent": "^3.1.0",
"inherits": "^2.0.3", "inherits": "^2.0.3",
"is-binary-path": "^1.0.0", "is-binary-path": "^1.0.0",
@ -16638,6 +16649,17 @@
} }
} }
}, },
"fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"glob-parent": { "glob-parent": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
@ -17459,6 +17481,18 @@
} }
} }
}, },
"winusb-driver-generator": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/winusb-driver-generator/-/winusb-driver-generator-1.2.7.tgz",
"integrity": "sha512-NMRpH61jvvU32kGp7TcB0uzC2vxbTNpdX8kkGn4RLafycm5bKRKNzIqinnshs8G5Z7VFAMVACaCo1uPLslT3nw==",
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.3.0",
"nan": "^2.14.0",
"prebuild-install": "^5.2.2"
}
},
"wordwrap": { "wordwrap": {
"version": "0.0.3", "version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
@ -17882,4 +17916,4 @@
} }
} }
} }
} }

View File

@ -91,6 +91,7 @@
"node-gyp": "^7.0.0", "node-gyp": "^7.0.0",
"node-ipc": "^9.1.1", "node-ipc": "^9.1.1",
"omit-deep-lodash": "1.1.4", "omit-deep-lodash": "1.1.4",
"outdent": "^0.7.1",
"path-is-inside": "^1.0.2", "path-is-inside": "^1.0.2",
"pretty-bytes": "^5.3.0", "pretty-bytes": "^5.3.0",
"react": "^16.8.5", "react": "^16.8.5",
@ -109,7 +110,7 @@
"sudo-prompt": "^9.0.0", "sudo-prompt": "^9.0.0",
"sys-class-rgb-led": "^2.1.0", "sys-class-rgb-led": "^2.1.0",
"tmp": "^0.2.1", "tmp": "^0.2.1",
"ts-loader": "^7.0.5", "ts-loader": "^8.0.0",
"ts-node": "^8.3.0", "ts-node": "^8.3.0",
"typescript": "^3.5.3", "typescript": "^3.5.3",
"uuid": "^8.1.0", "uuid": "^8.1.0",

View File

@ -1,14 +1,11 @@
{ {
"compilerOptions": { "compilerOptions": {
"noImplicitAny": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"strictNullChecks": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"allowJs": true,
"moduleResolution": "node",
"module": "commonjs", "module": "commonjs",
"target": "es2018", "target": "es2019",
"jsx": "react", "jsx": "react",
"typeRoots": ["./node_modules/@types", "./typings"], "typeRoots": ["./node_modules/@types", "./typings"],
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true