From d87e31b53b9fe346688355685311210f4a4044c4 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 13 Feb 2019 11:46:39 -0700 Subject: [PATCH 01/12] upgrade to typescript v3, add it as a peerdep to enforce downstream project support --- package.json | 5 +++-- src/services/popover/popover_positioning.ts | 6 +++--- yarn.lock | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8a84664331a..0d00b1126e0 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ "tslint": "^5.11.0", "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^2.9.2", + "typescript": "^3.3.3", "uglifyjs-webpack-plugin": "^2.0.1", "url-loader": "^1.0.1", "wdio-chromedriver-service": "^0.1.2", @@ -183,6 +183,7 @@ "moment": "^2.13.0", "prop-types": "^15.5.0", "react": "^16.3", - "react-dom": "^16.3" + "react-dom": "^16.3", + "typescript": "^3.0.0" } } diff --git a/src/services/popover/popover_positioning.ts b/src/services/popover/popover_positioning.ts index d99c94ca85c..d2e9a6627b1 100644 --- a/src/services/popover/popover_positioning.ts +++ b/src/services/popover/popover_positioning.ts @@ -59,7 +59,7 @@ const positionSubstitutes: { interface FindPopoverPositionArgs { anchor: HTMLElement; popover: HTMLElement; - align?: EuiPopoverPosition; + align?: EuiPopoverPosition | null; position: EuiPopoverPosition; forcePosition?: boolean; buffer?: number; @@ -744,8 +744,8 @@ export function getElementZIndex( for (const node of nodesToInspect) { // get this node's z-index css value - const zIndex = window.document.defaultView - .getComputedStyle(node) + const zIndex = window.document + .defaultView!.getComputedStyle(node) .getPropertyValue('z-index'); // if the z-index is not a number (e.g. "auto") return null, else the value diff --git a/yarn.lock b/yarn.lock index 0fa64f3090b..cb0c0bb1f09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13702,10 +13702,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^2.9.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" - integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w== +typescript@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221" + integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A== ua-parser-js@^0.7.18, ua-parser-js@^0.7.9: version "0.7.18" From 46374dc49c8e0b9bea640301d7e8946ccd3a70b9 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 13 Feb 2019 11:46:39 -0700 Subject: [PATCH 02/12] upgrade to typescript v3, add it as a peerdep to enforce downstream project support --- package.json | 5 +++-- src/services/popover/popover_positioning.ts | 6 +++--- yarn.lock | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index d11efe3de56..fdaec9b5dfc 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ "tslint": "^5.11.0", "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^2.9.2", + "typescript": "^3.3.3", "uglifyjs-webpack-plugin": "^2.0.1", "url-loader": "^1.0.1", "wdio-chromedriver-service": "^0.1.2", @@ -183,6 +183,7 @@ "moment": "^2.13.0", "prop-types": "^15.5.0", "react": "^16.3", - "react-dom": "^16.3" + "react-dom": "^16.3", + "typescript": "^3.0.0" } } diff --git a/src/services/popover/popover_positioning.ts b/src/services/popover/popover_positioning.ts index d99c94ca85c..d2e9a6627b1 100644 --- a/src/services/popover/popover_positioning.ts +++ b/src/services/popover/popover_positioning.ts @@ -59,7 +59,7 @@ const positionSubstitutes: { interface FindPopoverPositionArgs { anchor: HTMLElement; popover: HTMLElement; - align?: EuiPopoverPosition; + align?: EuiPopoverPosition | null; position: EuiPopoverPosition; forcePosition?: boolean; buffer?: number; @@ -744,8 +744,8 @@ export function getElementZIndex( for (const node of nodesToInspect) { // get this node's z-index css value - const zIndex = window.document.defaultView - .getComputedStyle(node) + const zIndex = window.document + .defaultView!.getComputedStyle(node) .getPropertyValue('z-index'); // if the z-index is not a number (e.g. "auto") return null, else the value diff --git a/yarn.lock b/yarn.lock index 0fa64f3090b..cb0c0bb1f09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13702,10 +13702,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^2.9.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" - integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w== +typescript@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3.tgz#f1657fc7daa27e1a8930758ace9ae8da31403221" + integrity sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A== ua-parser-js@^0.7.18, ua-parser-js@^0.7.9: version "0.7.18" From 8165d5883a487b382502081bb5b590dd416f4af1 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 20 Feb 2019 10:07:31 -0700 Subject: [PATCH 03/12] Change popover positioning's align type to use undefined instead of null --- src/services/popover/popover_positioning.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/services/popover/popover_positioning.ts b/src/services/popover/popover_positioning.ts index d2e9a6627b1..9cee32a8657 100644 --- a/src/services/popover/popover_positioning.ts +++ b/src/services/popover/popover_positioning.ts @@ -59,7 +59,7 @@ const positionSubstitutes: { interface FindPopoverPositionArgs { anchor: HTMLElement; popover: HTMLElement; - align?: EuiPopoverPosition | null; + align?: EuiPopoverPosition; position: EuiPopoverPosition; forcePosition?: boolean; buffer?: number; @@ -97,7 +97,7 @@ interface FindPopoverPositionArgs { export function findPopoverPosition({ anchor, popover, - align = null, + align, position, forcePosition, buffer = 16, @@ -151,7 +151,7 @@ export function findPopoverPosition({ // Try the user-desired position first. const iterationPositions = [position]; // keep user-defined alignment in the original positions. - const iterationAlignments: Array = [align]; + const iterationAlignments: Array = [align]; if (forcePosition !== true) { iterationPositions.push(positionComplements[position]); // Try the complementary position. @@ -162,7 +162,7 @@ export function findPopoverPosition({ positionSubstitutes[position], // Switch to the cross axis. positionComplements[positionSubstitutes[position]] // Try the complementary position on the cross axis. ); - iterationAlignments.push(null, null); // discard desired alignment on cross-axis + iterationAlignments.push(undefined, undefined); // discard desired alignment on cross-axis } } else { // position is forced, if it conficts with the alignment then reset align to `null` @@ -170,9 +170,9 @@ export function findPopoverPosition({ // will position and align `left`, and `leftLeft` is not a valid placement if ( position === align || - (align != null && position === positionComplements[align]) + (align !== undefined && position === positionComplements[align]) ) { - iterationAlignments[0] = null; + iterationAlignments[0] = undefined; } } @@ -219,7 +219,7 @@ export function findPopoverPosition({ interface GetPopoverScreenCoordinatesArgs { position: EuiPopoverPosition; - align?: EuiPopoverPosition | null; + align?: EuiPopoverPosition; anchorBoundingBox: EuiClientRect; popoverBoundingBox: EuiClientRect; windowBoundingBox: EuiClientRect; @@ -254,7 +254,7 @@ interface GetPopoverScreenCoordinatesArgs { */ export function getPopoverScreenCoordinates({ position, - align = null, + align, anchorBoundingBox, popoverBoundingBox, windowBoundingBox, @@ -382,7 +382,7 @@ interface GetCrossAxisPositionArgs { crossAxisSecondSide: EuiPopoverPosition; crossAxisDimension: Dimension; position: EuiPopoverPosition; - align: EuiPopoverPosition | null; + align?: EuiPopoverPosition; buffer: number; offset: number; windowBoundingBox: EuiClientRect; From e0ff50c16c564a1273826aa723e17cd73f860065 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Wed, 20 Feb 2019 10:45:43 -0700 Subject: [PATCH 04/12] Upgrade @types/react and @types/prop-types versions --- package.json | 3 ++- yarn.lock | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index fdaec9b5dfc..2b7103e1f50 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@types/classnames": "^2.2.6", "@types/enzyme": "^3.1.13", "@types/jest": "^23.3.9", - "@types/react": "^16.3.0", + "@types/react": "^16.8.4", "@types/react-is": "~16.3.0", "@types/react-virtualized": "^9.18.6", "@types/uuid": "^3.4.4", @@ -180,6 +180,7 @@ }, "peerDependencies": { "@elastic/datemath": "^5.0.2", + "@types/react": "^16.8.0", "moment": "^2.13.0", "prop-types": "^15.5.0", "react": "^16.3", diff --git a/yarn.lock b/yarn.lock index cb0c0bb1f09..da37dfb2d3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -890,9 +890,9 @@ integrity sha512-ShHzHkYD+Ldw3eyttptCpUhF1/mkInWwasQkCNXZHOsJMJ/UMa8wXrxSrTJaVk0r4pLK/VnESVM0wFsfQzNEKQ== "@types/prop-types@*": - version "15.5.3" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.3.tgz#bef071852dca2a2dbb65fecdb7bfb30cedae2de2" - integrity sha512-sfjHrNF4zWRv3fJUGyZW46wVxhYJ/GeWIPdKxbnLIhY3bWR0Ncl2kIhZI7rpjY9KtUQAkDP8jWEmaGQGFFvruA== + version "15.5.9" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.9.tgz#f2d14df87b0739041bc53a7d75e3d77d726a3ec0" + integrity sha512-Nha5b+jmBI271jdTMwrHiNXM+DvThjHOfyZtMX9kj/c/LUj2xiLHsG/1L3tJ8DjAoQN48cHwUwtqBotjyXaSdQ== "@types/react-is@~16.3.0": version "16.3.1" @@ -909,11 +909,12 @@ "@types/prop-types" "*" "@types/react" "*" -"@types/react@*", "@types/react@^16.3.0": - version "16.3.14" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.3.14.tgz#f90ac6834de172e13ecca430dcb6814744225d36" - integrity sha512-wNUGm49fPl7eE2fnYdF0v5vSOrUMdKMQD/4NwtQRnb6mnPwtkhabmuFz37eq90+hhyfz0pWd38jkZHOcaZ6LGw== +"@types/react@*", "@types/react@^16.8.4": + version "16.8.4" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.4.tgz#134307f5266e866d5e7c25e47f31f9abd5b2ea34" + integrity sha512-Mpz1NNMJvrjf0GcDqiK8+YeOydXfD8Mgag3UtqQ5lXYTsMnOiHcKmO48LiSWMb1rSHB9MV/jlgyNzeAVxWMZRQ== dependencies: + "@types/prop-types" "*" csstype "^2.2.0" "@types/uuid@^3.4.4": From 6a1a4ced4dfe90989c8cd8914cf7e2159a03cd9d Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Thu, 21 Feb 2019 10:25:46 -0700 Subject: [PATCH 05/12] Update TSX files to move default prop values in function signature; upgrade React & ReactDOM to 16.8, upgrade enzyme & related libs to latest --- package.json | 12 +- scripts/jest/setup/enzyme.js | 2 +- .../__snapshots__/basic_table.test.js.snap | 2501 ++++++++--------- .../custom_item_action.test.js.snap | 7 +- .../__snapshots__/quick_select.test.js.snap | 10 +- .../quick_select_popover.test.js.snap | 84 +- src/components/delay_hide/delay_hide.tsx | 11 +- src/components/expression/expression.tsx | 14 +- .../__snapshots__/super_select.test.js.snap | 1 - .../horizontal_rule/horizontal_rule.tsx | 11 +- src/components/icon/icon.tsx | 4 - .../portal/__snapshots__/portal.test.js.snap | 12 +- src/components/portal/portal.test.js | 9 +- .../__snapshots__/search_filters.test.js.snap | 120 +- src/components/spacer/spacer.tsx | 12 +- src/services/popover/popover_positioning.ts | 2 +- yarn.lock | 233 +- 17 files changed, 1481 insertions(+), 1564 deletions(-) diff --git a/package.json b/package.json index 2b7103e1f50..b57b1a43b2b 100644 --- a/package.json +++ b/package.json @@ -100,8 +100,8 @@ "css-loader": "^0.28.7", "cssnano": "^4.0.5", "dts-generator": "^2.1.0", - "enzyme": "^3.1.0", - "enzyme-adapter-react-16.3": "^1.4.1", + "enzyme": "^3.9.0", + "enzyme-adapter-react-16": "^1.9.1", "enzyme-to-json": "^3.3.0", "eslint": "^4.9.0", "eslint-config-prettier": "^2.9.0", @@ -139,8 +139,8 @@ "prompt": "^1.0.0", "prop-types": "^15.6.0", "raw-loader": "^0.5.1", - "react": "^16.3.0", - "react-dom": "^16.3.0", + "react": "^16.8.0", + "react-dom": "^16.8.0", "react-redux": "^5.0.6", "react-router": "^3.2.0", "react-router-redux": "^4.0.8", @@ -183,8 +183,8 @@ "@types/react": "^16.8.0", "moment": "^2.13.0", "prop-types": "^15.5.0", - "react": "^16.3", - "react-dom": "^16.3", + "react": "^16.8", + "react-dom": "^16.8", "typescript": "^3.0.0" } } diff --git a/scripts/jest/setup/enzyme.js b/scripts/jest/setup/enzyme.js index 7c4def46489..82edfc9e5ad 100644 --- a/scripts/jest/setup/enzyme.js +++ b/scripts/jest/setup/enzyme.js @@ -1,4 +1,4 @@ import { configure } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16.3'; +import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); diff --git a/src/components/basic_table/__snapshots__/basic_table.test.js.snap b/src/components/basic_table/__snapshots__/basic_table.test.js.snap index 23424377961..e6974b7959f 100644 --- a/src/components/basic_table/__snapshots__/basic_table.test.js.snap +++ b/src/components/basic_table/__snapshots__/basic_table.test.js.snap @@ -37,63 +37,51 @@ exports[`EuiBasicTable cellProps renders cells with custom props from a callback - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + @@ -137,63 +125,51 @@ exports[`EuiBasicTable cellProps renders rows with custom props from an object 1 - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + @@ -422,102 +398,90 @@ exports[`EuiBasicTable footers do not render without a column footer definition - - - - name1 - - - 1 - - - 20 - - - - + + 1 + + + 20 + + + - - - name2 - - - 2 - - - 21 - - - - + + 2 + + + 21 + + + - - - name3 - - - 3 - - - 22 - - - + name3 + + + 3 + + + 22 + + @@ -573,7 +537,9 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f + > + + - - - - - - - name1 - - - 1 - - - 20 - - - - - + + + - - - - - name2 - - - 2 - - - 21 - - - - + + 1 + + + 20 + + + - - - - - - name3 - - - 3 - - + + + + name2 + + + 2 + + + 21 + + + + + - 22 - - - + + + + + name3 + + + 3 + + + 22 + + - - - - name1 - - - + + + - -
- Expanded row -
-
-
-
- + Expanded row + + + + - - - name2 - - - - + + - - - name3 - - - + name3 + +
@@ -919,69 +867,57 @@ exports[`EuiBasicTable rowProps renders rows with custom props from a callback 1
- - - + + - - name1 - - - - - - - + + + + + - - name2 - - - - - - - + + + + + - - name3 - - - - + name3 + + + @@ -1025,69 +961,57 @@ exports[`EuiBasicTable rowProps renders rows with custom props from an object 1` - - - + + - - name1 - - - - - - - + + + + + - - name2 - - - - - - - + + + + + - - name3 - - - - + name3 + + + @@ -1131,38 +1055,30 @@ exports[`EuiBasicTable with pagination - 2nd page 1`] = ` - - - - name1 - - - - + + - - - name2 - - - + name2 + + @@ -1217,54 +1133,42 @@ exports[`EuiBasicTable with pagination 1`] = ` - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + @@ -1328,7 +1232,6 @@ exports[`EuiBasicTable with pagination and error 1`] = ` > @@ -1376,7 +1279,9 @@ exports[`EuiBasicTable with pagination and selection 1`] = ` + > + + - - - - - - - name1 - - - - + + + + name1 + + + - - - - - - name2 - - - - + + + + name2 + + + - - - - - - name3 - - - + + + + + name3 + + @@ -1517,54 +1416,42 @@ exports[`EuiBasicTable with pagination, hiding the per page options 1`] = ` - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + @@ -1632,7 +1519,9 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = ` + > + + - - - - - - - name1 - - - - + + + + name1 + + + - - - - - - name2 - - - - + + + + name2 + + + - - - - - - name3 - - - + + + + + name3 + + @@ -1788,7 +1671,9 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a + > + + - - - - - - - name1 - - - + + + + name1 + + + - - - - + + + - - - - - - name2 - - - + + + + name2 + + + - - - - + + + - - - - - - name3 - - - + + + + name3 + + + - - - + } + itemId="3" + /> + + @@ -2038,7 +1917,9 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1 + > + + - - - - - - - 1 - - - - + + + + 1 + + + - - - - - - 2 - - - - + + + + 2 + + + - - - - - - 3 - - - + + + + + + 3 + + @@ -2194,7 +2069,9 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1 + > + + - - - - - - - NAME1 - - - - + + + + NAME1 + + + - - - - - - NAME2 - - - - + + + + NAME2 + + + - - - - - - NAME3 - - - + + + + + NAME3 + + @@ -2350,7 +2221,9 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a + > + + - - - - - - - name1 - - - + + + + name1 + + + - - - - + + + - - - - - - name2 - - - + + + + name2 + + + - - - - + + + - - - - - - name3 - - - + + + + name3 + + + - - - + } + itemId="3" + /> + + @@ -2618,7 +2485,9 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and + > + + - - - - - - - x - - - - + + + + x + + + - - - - - - xx - - - - + + + + xx + + + - - - - - - xxx - - - + + + + + xxx + + @@ -2762,54 +2625,42 @@ exports[`EuiBasicTable with sortable columns and sorting disabled 1`] = ` - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + @@ -2870,54 +2721,42 @@ exports[`EuiBasicTable with sorting 1`] = ` - - - - name1 - - - - + + - - - name2 - - - - + + - - - name3 - - - + name3 + + diff --git a/src/components/basic_table/__snapshots__/custom_item_action.test.js.snap b/src/components/basic_table/__snapshots__/custom_item_action.test.js.snap index 8094d63208a..bcf25f1339c 100644 --- a/src/components/basic_table/__snapshots__/custom_item_action.test.js.snap +++ b/src/components/basic_table/__snapshots__/custom_item_action.test.js.snap @@ -3,5 +3,10 @@ exports[`CustomItemAction render 1`] = `
+> + +
`; diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select.test.js.snap b/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select.test.js.snap index 37fcd8b38a8..85fa7767ee1 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select.test.js.snap +++ b/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EuiQuickSelect is rendered 1`] = ` - + - + `; exports[`EuiQuickSelect prevQuickSelect 1`] = ` - + - + `; diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.js.snap b/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.js.snap index 45db5f6c09b..b2f89eaabb9 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.js.snap +++ b/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.js.snap @@ -21,7 +21,6 @@ exports[`EuiQuickSelectPopover is rendered 1`] = ` type="button" > @@ -37,48 +36,46 @@ exports[`EuiQuickSelectPopover is rendered 1`] = ` className="euiQuickSelectPopover__content" data-test-subj="superDatePickerQuickMenu" > - - - - - + + + diff --git a/src/components/delay_hide/delay_hide.tsx b/src/components/delay_hide/delay_hide.tsx index f450a764238..898a5e9f64b 100644 --- a/src/components/delay_hide/delay_hide.tsx +++ b/src/components/delay_hide/delay_hide.tsx @@ -8,13 +8,13 @@ function isComponentBecomingVisible( } export interface EuiDelayHideProps { - hide?: boolean; - minimumDuration?: number; + hide: boolean; + minimumDuration: number; render: () => ReactNode; } interface EuiDelayHideState { - hide?: boolean; + hide: boolean; countdownExpired?: boolean; } @@ -76,7 +76,10 @@ export class EuiDelayHide extends Component< if (this.timeoutId == null) { this.timeoutId = setTimeout( this.finishCountdown, - this.props.minimumDuration + // even though `minimumDuration` cannot be undefined, passing a strict number type to setTimeout makes TS interpret + // it as a NodeJS.Timer instead of a number. The DOM lib defines the setTimeout call as taking `number | undefined` + // so we cast minimumDuration to this type instead to force TS's cooperation + this.props.minimumDuration as number | undefined ); } }; diff --git a/src/components/expression/expression.tsx b/src/components/expression/expression.tsx index d19660ea595..1c466c3a86f 100644 --- a/src/components/expression/expression.tsx +++ b/src/components/expression/expression.tsx @@ -62,9 +62,9 @@ export const EuiExpression: React.SFC> = ({ descriptionProps, value, valueProps, - color, - uppercase, - isActive, + color = 'secondary', + uppercase = true, + isActive = false, onClick, ...rest }) => { @@ -76,7 +76,7 @@ export const EuiExpression: React.SFC> = ({ 'euiExpression-isClickable': onClick, 'euiExpression-isUppercase': uppercase, }, - color ? colorToClassNameMap[color] : undefined + colorToClassNameMap[color] ); const Component = onClick ? 'button' : 'span'; @@ -92,9 +92,3 @@ export const EuiExpression: React.SFC> = ({ ); }; - -EuiExpression.defaultProps = { - color: 'secondary', - uppercase: true, - isActive: false, -}; diff --git a/src/components/form/super_select/__snapshots__/super_select.test.js.snap b/src/components/form/super_select/__snapshots__/super_select.test.js.snap index 9281e631568..453c19b57ca 100644 --- a/src/components/form/super_select/__snapshots__/super_select.test.js.snap +++ b/src/components/form/super_select/__snapshots__/super_select.test.js.snap @@ -590,7 +590,6 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = `