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

update to TypeScript v3.8-rc #57774

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion examples/demo_search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion examples/embeddable_examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion examples/embeddable_explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion examples/search_explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion examples/state_containers_examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"**/@types/hapi": "^17.0.18",
"**/@types/angular": "^1.6.56",
"**/@types/hoist-non-react-statics": "^3.3.1",
"**/typescript": "3.7.2",
"**/typescript": "3.8.2",
"**/graphql-toolkit/lodash": "^4.17.13",
"**/hoist-non-react-statics": "^3.3.2",
"**/isomorphic-git/**/base64-js": "^1.2.1",
Expand Down Expand Up @@ -479,7 +479,7 @@
"supertest": "^3.1.0",
"supertest-as-promised": "^4.0.2",
"tree-kill": "^1.2.2",
"typescript": "3.7.2",
"typescript": "3.8.2",
"typings-tester": "^0.3.2",
"vinyl-fs": "^3.0.3",
"xml2js": "^0.4.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"@babel/cli": "^7.5.5",
"@kbn/dev-utils": "1.0.0",
"@kbn/babel-preset": "1.0.0",
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
4 changes: 4 additions & 0 deletions packages/kbn-babel-preset/common_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const plugins = [
// See https://github.com/babel/proposals/issues/12 for progress
require.resolve('@babel/plugin-proposal-class-properties'),

// Proposal is on stage 4 (https://github.com/tc39/proposal-export-ns-from)
// Need this since we are using TypeScript 3.8+
require.resolve('@babel/plugin-proposal-export-namespace-from'),

// Optional Chaining proposal is stage 3 (https://github.com/tc39/proposal-optional-chaining)
// Need this since we are using TypeScript 3.7+
require.resolve('@babel/plugin-proposal-optional-chaining'),
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.5.1",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"kbn:bootstrap": "yarn build"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
},
"peerDependencies": {
"joi": "^13.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"typescript": "3.7.2",
"typescript": "3.8.2",
"@kbn/expect": "1.0.0",
"chance": "1.0.18"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"del": "^5.1.0",
"getopts": "^2.2.4",
"supports-color": "^7.0.0",
"typescript": "3.7.2"
"typescript": "3.8.2"
},
"dependencies": {
"intl-format-cache": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"strip-ansi": "^4.0.0",
"strong-log-transformer": "^2.1.0",
"tempy": "^0.3.0",
"typescript": "3.7.2",
"typescript": "3.8.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Thinking) npm really need a maven-like pinable version management for multi-projects...

"unlazy-loader": "^0.1.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
Expand Down
6 changes: 2 additions & 4 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as Public from './public';
import * as Server from './server';

export { Public, Server };
export * as Public from './public';
export * as Server from './server';
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class HeaderBadge extends Component<Props, State> {
<div className="chrHeaderBadge__wrapper">
<EuiBetaBadge
data-test-subj="headerBadge"
data-test-badge-label={this.state.badge.text}
data-test-badge-label={(this.state.badge.text as unknown) as undefined}
mshustov marked this conversation as resolved.
Show resolved Hide resolved
tabIndex={0}
label={this.state.badge.text}
tooltipContent={this.state.badge.tooltip}
Expand Down
1 change: 1 addition & 0 deletions src/dev/i18n/extractors/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function* extractCodeMessages(buffer, reporter) {
'dynamicImport',
'nullishCoalescingOperator',
'optionalChaining',
'exportNamespaceFrom',
],
});
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { migratePanelsTo730 } from '../../migrations/migrate_to_730_panels';
* Once we hit a major version, we can remove support for older style URLs and get rid of this logic.
*/
export function migrateAppState(
appState: { [key: string]: unknown } & DashboardAppState,
appState: { [key: string]: any } & DashboardAppState,
kibanaVersion: string
): DashboardAppState {
if (!appState.panels) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => {
// @ts-ignore
vis = new visualizationsStart.Vis(stubIndexPattern, {
type: 'metric',
aggs: [{ id: '1', type: 'top_hits', schema: 'metric', params: { field: 'ip' } }],
aggs: [{ id: '1', type: 'top_hits', schema: 'metric', params: { field: 'ip' } }] as any,
});

vis.params.dimensions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ const emptyCaption = '<br>';
function Panel({ interval, seriesList, renderComplete }: PanelProps) {
const kibana = useKibana<TimelionVisDependencies>();
const [chart, setChart] = useState(() => cloneDeep(seriesList.list));
const [canvasElem, setCanvasElem] = useState();
const [chartElem, setChartElem] = useState();
const [canvasElem, setCanvasElem] = useState<HTMLElement>();
Copy link
Contributor Author

@mshustov mshustov Feb 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file still contains some type errors. @timroes @sulemanof could someone take a look and fix the errors, please?

const [chartElem, setChartElem] = useState<HTMLElement>();

const [originalColorMap, setOriginalColorMap] = useState(() => new Map<Series, string>());

const [highlightedSeries, setHighlightedSeries] = useState<number | null>(null);
const [focusedSeries, setFocusedSeries] = useState();
const [plot, setPlot] = useState();
const [focusedSeries, setFocusedSeries] = useState<number | null>();
const [plot, setPlot] = useState<jquery.flot.plot>();

// Used to toggle the series, and for displaying values on hover
const [legendValueNumbers, setLegendValueNumbers] = useState();
const [legendCaption, setLegendCaption] = useState();
const [legendValueNumbers, setLegendValueNumbers] = useState<JQuery<HTMLElement>>();
const [legendCaption, setLegendCaption] = useState<JQuery<HTMLElement>>();

const canvasRef = useCallback(node => {
if (node !== null) {
Expand All @@ -97,7 +97,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {

useEffect(
() => () => {
$(chartElem)
$(chartElem!)
.off('plotselected')
.off('plothover')
.off('mouseleave');
Expand Down Expand Up @@ -156,11 +156,11 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
caption.html(emptyCaption);
setLegendCaption(caption);

const canvasNode = $(canvasElem);
const canvasNode = $(canvasElem!);
canvasNode.find('div.legend table').append(caption);
setLegendValueNumbers(canvasNode.find('.ngLegendValueNumber'));

const legend = $(canvasElem).find('.ngLegendValue');
const legend = $(canvasElem!).find('.ngLegendValue');
if (legend) {
legend.click(toggleSeries);
legend.focus(focusSeries);
Expand Down Expand Up @@ -254,20 +254,20 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
(pos: Position) => {
unhighlightSeries();

const axes = plot.getAxes();
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max) {
const axes = plot!.getAxes();
if (pos.x < axes.xaxis.min! || pos.x > axes.xaxis.max!) {
return;
}

const dataset = plot.getData();
const dataset = plot!.getData();
if (legendCaption) {
legendCaption.text(
moment(pos.x).format(get(dataset, '[0]._global.legend.timeFormat', DEFAULT_TIME_FORMAT))
);
}
for (let i = 0; i < dataset.length; ++i) {
const series = dataset[i];
const useNearestPoint = series.lines.show && !series.lines.steps;
const useNearestPoint = series.lines!.show && !series.lines!.steps;
const precision = get(series, '_meta.precision', 2);

if (series._hide) {
Expand All @@ -289,12 +289,12 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {

if (y != null && legendValueNumbers) {
let label = y.toFixed(precision);
if (series.yaxis.tickFormatter) {
label = series.yaxis.tickFormatter(Number(label), series.yaxis);
if (series.yaxis!.tickFormatter) {
label = series.yaxis!.tickFormatter(Number(label), series.yaxis);
}
legendValueNumbers.eq(i).text(`(${label})`);
} else {
legendValueNumbers.eq(i).empty();
legendValueNumbers!.eq(i).empty();
}
}
},
Expand All @@ -314,7 +314,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
if (legendCaption) {
legendCaption.html(emptyCaption);
}
each(legendValueNumbers, (num: Node) => {
each(legendValueNumbers!, (num: Node) => {
$(num).empty();
});
}, [legendCaption, legendValueNumbers]);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function ShardFailureModal({ request, response, title, onClose }: Props)
</EuiButtonEmpty>
)}
</EuiCopy>
<EuiButton onClick={() => onClose()} fill data-test-sub="closeShardFailureModal">
<EuiButton onClick={() => onClose()} fill data-test-subj="closeShardFailureModal">
<FormattedMessage
id="data.search.searchSource.fetch.shardsFailedModal.close"
defaultMessage="Close"
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/share/public/components/url_panel_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class UrlPanelContent extends Component<Props, State> {
fullWidth
onClick={copy}
disabled={this.state.isCreatingShortUrl || this.state.url === ''}
data-share-url={this.state.url}
data-share-url={(this.state.url as unknown) as undefined}
data-test-subj="copyShareUrlButton"
size="s"
>
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_functional/plugins/core_plugin_a/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
2 changes: 1 addition & 1 deletion test/plugin_functional/plugins/core_plugin_b/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.8.2"
}
}
6 changes: 6 additions & 0 deletions x-pack/dev-tools/jest/setup/setup_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@

import 'jest-styled-components';
import '@testing-library/jest-dom/extend-expect';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as testingLibraryDom from '@testing-library/dom';

testingLibraryDom.configure({
testIdAttribute: 'data-test-subj',
Copy link
Contributor Author

@mshustov mshustov Feb 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a bunch of type errors due to data-testid not being declared on EUI elements. Our component library shouldn't depend on 3rd party libraries naming conventions, so I reconfigured @testing-library to use Kibana specific data-test-subj attribute instead.

});
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/apm/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"js-yaml": "^3.13.1",
"p-limit": "^2.2.1",
"ts-loader": "^6.1.0",
"typescript": "3.7.2",
"typescript": "3.8.2",
"webpack": "^4.41.5"
}
}