Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to typescript 3.5.3 #3654

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"sinon": "^7.2.4",
"stylelint-config-palantir": "^3.1.1",
"stylelint-scss": "^3.8.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"yarn-deduplicate": "^1.1.1"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"sass-inline-svg": "^1.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
28 changes: 7 additions & 21 deletions packages/core/src/common/utils/compareUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,6 @@ export function deepCompareKeys(objA: any, objB: any, keys?: Array<string | numb
}
}

/**
* Returns a descriptive object for each key whose values are shallowly unequal
* between two provided objects. Useful for debugging shouldComponentUpdate.
*/
export function getShallowUnequalKeyValues<T extends object>(
objA: T,
objB: T,
keys?: IKeyBlacklist<T> | IKeyWhitelist<T>,
) {
// default param values let null values pass through, so we have to take
// this more thorough approach
const definedObjA = objA == null ? {} : objA;
const definedObjB = objB == null ? {} : objB;

const filteredKeys = _filterKeys(definedObjA, definedObjB, keys == null ? { exclude: [] } : keys);
return _getUnequalKeyValues(definedObjA, definedObjB, filteredKeys, (a, b, key) => {
return shallowCompareKeys(a, b, { include: [key] });
});
}

/**
* Returns a descriptive object for each key whose values are deeply unequal
* between two provided objects. Useful for debugging shouldComponentUpdate.
Expand Down Expand Up @@ -158,7 +138,7 @@ function _isSimplePrimitiveType(value: any) {
function _filterKeys<T>(objA: T, objB: T, keys: IKeyBlacklist<T> | IKeyWhitelist<T>) {
if (_isWhitelist(keys)) {
return keys.include;
} else {
} else if (_isBlacklist(keys)) {
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);

Expand All @@ -171,12 +151,18 @@ function _filterKeys<T>(objA: T, objB: T, keys: IKeyBlacklist<T> | IKeyWhitelist
// return the remaining keys as an array
return Object.keys(keySet) as Array<keyof T>;
}

return [];
}

function _isWhitelist<T>(keys: any): keys is IKeyWhitelist<T> {
return keys != null && (keys as IKeyWhitelist<T>).include != null;
}

function _isBlacklist<T>(keys: any): keys is IKeyBlacklist<T> {
return keys != null && (keys as IKeyBlacklist<T>).exclude != null;
}

function _arrayToObject(arr: any[]) {
return arr.reduce((obj: any, element: any) => {
obj[element] = true;
Expand Down
54 changes: 0 additions & 54 deletions packages/core/test/common/utils/compareUtilsTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,60 +269,6 @@ describe("CompareUtils", () => {
});
});

describe("getShallowUnequalKeyValues", () => {
describe("with `keys` defined as whitelist", () => {
describe("returns empty array if the specified values are shallowly equal", () => {
runTest([], { a: 1, b: [1, 2, 3], c: "3" }, { b: [1, 2, 3], a: 1, c: "3" }, wl(["a", "c"]));
});

describe("returns unequal key/values if any specified values are not shallowly equal", () => {
// identical objects, but different instances
runTest(
[{ key: "a", valueA: [1, "2", true], valueB: [1, "2", true] }],
{ a: [1, "2", true] },
{ a: [1, "2", true] },
wl(["a"]),
);
// different primitive-type values
runTest([{ key: "a", valueA: 1, valueB: 2 }], { a: 1 }, { a: 2 }, wl(["a"]));
});
});

describe("with `keys` defined as blacklist", () => {
describe("returns empty array if the specified values are shallowly equal", () => {
runTest([], { a: 1, b: [1, 2, 3], c: "3" }, { b: [1, 2, 3], a: 1, c: "3" }, bl(["b"]));
});

describe("returns unequal keys/values if any specified values are not shallowly equal", () => {
runTest(
[{ key: "a", valueA: [1, "2", true], valueB: [1, "2", true] }],
{ a: [1, "2", true] },
{ a: [1, "2", true] },
bl(["b", "c"]),
);
runTest([{ key: "a", valueA: 1, valueB: 2 }], { a: 1 }, { a: 2 }, bl(["b"]));
});
});

describe("with `keys` not defined", () => {
describe("returns empty array if values are shallowly equal", () => {
runTest([], { a: 1, b: "2", c: true }, { a: 1, b: "2", c: true });
runTest([], undefined, undefined);
runTest([], null, undefined);
});

describe("returns unequal key/values if any specified values are not shallowly equal", () => {
runTest([{ key: "a", valueA: 1, valueB: 2 }], { a: 1 }, { a: 2 });
});
});

function runTest(expectedResult: any[], a: any, b: any, keys?: IKeyBlacklist<IKeys> | IKeyWhitelist<IKeys>) {
it(getCompareTestDescription(a, b, keys), () => {
expect(CompareUtils.getShallowUnequalKeyValues(a, b, keys)).to.deep.equal(expectedResult);
});
}
});

describe("getDeepUnequalKeyValues", () => {
describe("with `keys` defined", () => {
describe("returns empty array if only the specified values are deeply equal", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"npm-run-all": "^4.1.5",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.3.0"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/node-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"stylelint-junit-formatter": "^0.2.1",
"svgo": "^1.2.2",
"tslint": "^5.12.1",
"typescript": "~3.2.4"
"typescript": "~3.5.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/test-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"devDependencies": {
"react": "^16.2.0",
"typescript": "~3.2.4"
"typescript": "~3.5.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/timezone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~3.2.4",
"typescript": "~3.5.3",
"webpack-cli": "^3.1.2"
},
"repository": {
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10567,11 +10567,16 @@ typedoc@0.14.2, typedoc@^0.15.0-0:
typedoc-default-themes "^0.5.0"
typescript "3.2.x"

typescript@3.2.x, typescript@~3.2.4:
typescript@3.2.x:
version "3.2.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d"
integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==

typescript@~3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==

ua-parser-js@^0.7.18:
version "0.7.19"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"
Expand Down