Upgrade invariant types

Summary: The new type defs make use of TypeScript 3.7 assertion functions which means they actually have a semantic effect on the rest of the lexical unit, which is quite neat.

Reviewed By: mweststrate

Differential Revision: D19348035

fbshipit-source-id: 3c7a21b5bece091c32f8879fed12d8e46e205ea4
This commit is contained in:
Pascal Hartig
2020-01-13 07:43:53 -08:00
committed by Facebook Github Bot
parent 5ea4c2211e
commit b2c3125a1a
4 changed files with 9 additions and 9 deletions

View File

@@ -68,7 +68,7 @@
"@types/expand-tilde": "^2.0.0", "@types/expand-tilde": "^2.0.0",
"@types/fb-watchman": "^2.0.0", "@types/fb-watchman": "^2.0.0",
"@types/fs-extra": "^8.0.0", "@types/fs-extra": "^8.0.0",
"@types/invariant": "^2.2.30", "@types/invariant": "^2.2.31",
"@types/jest": "^24.0.16", "@types/jest": "^24.0.16",
"@types/lodash.debounce": "^4.0.6", "@types/lodash.debounce": "^4.0.6",
"@types/lodash.isequal": "^4.5.5", "@types/lodash.isequal": "^4.5.5",

View File

@@ -332,8 +332,8 @@ export default class Client extends EventEmitter {
} else if (method === 'refreshPlugins') { } else if (method === 'refreshPlugins') {
this.refreshPlugins(); this.refreshPlugins();
} else if (method === 'execute') { } else if (method === 'execute') {
const params: Params = data.params as Params; invariant(data.params, 'expected params');
invariant(params, 'expected params'); const params: Params = data.params;
const device = this.getDeviceSync(); const device = this.getDeviceSync();
if (device) { if (device) {

View File

@@ -147,8 +147,8 @@ class TableHeadColumn extends PureComponent<{
const {parentElement} = this.ref; const {parentElement} = this.ref;
invariant(parentElement, 'expected there to be parentElement'); invariant(parentElement, 'expected there to be parentElement');
const parentWidth = parentElement!.clientWidth; const parentWidth = parentElement.clientWidth;
const {childNodes} = parentElement!; const {childNodes} = parentElement;
const lastElem = childNodes[childNodes.length - 1]; const lastElem = childNodes[childNodes.length - 1];
const right = const right =

View File

@@ -1233,10 +1233,10 @@
"@types/react" "*" "@types/react" "*"
hoist-non-react-statics "^3.3.0" hoist-non-react-statics "^3.3.0"
"@types/invariant@^2.2.30": "@types/invariant@^2.2.31":
version "2.2.30" version "2.2.31"
resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.30.tgz#20efa342807606ada5483731a8137cb1561e5fe9" resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.31.tgz#4444c03004f215289dbca3856538434317dd28b2"
integrity sha512-98fB+yo7imSD2F7PF7GIpELNgtLNgo5wjivu0W5V4jx+KVVJxo6p/qN4zdzSTBWy4/sN3pPyXwnhRSD28QX+ag== integrity sha512-jMlgg9pIURvy9jgBHCjQp/CyBjYHUwj91etVcDdXkFl2CwTFiQlB+8tcsMeXpXf2PFE5X2pjk4Gm43hQSMHAdA==
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
version "2.0.1" version "2.0.1"