From 25b1bec250a0719a93919fcffa6923589a36d7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 11 Mar 2019 20:44:14 +0100 Subject: [PATCH] Typescript noAny fixes, start of a long journey --- package.json | 1 + packages/grafana-ui/src/components/Gauge/Gauge.tsx | 5 ++--- public/app/core/components/jsontree/jsontree.ts | 4 ++-- yarn.lock | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d2760bbad02..c951e5241c1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.1.0", "@rtsao/plugin-proposal-class-properties": "^7.0.1-patch.1", + "@types/angular": "^1.6.6", "@types/chalk": "^2.2.0", "@types/classnames": "^2.2.6", "@types/commander": "^2.12.2", diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index d04daae3dab..aa6d2a40258 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -30,7 +30,7 @@ const FONT_SCALE = 1; export class Gauge extends PureComponent { canvasElement: any; - static defaultProps = { + static defaultProps: Partial = { maxValue: 100, valueMappings: [], minValue: 0, @@ -41,7 +41,6 @@ export class Gauge extends PureComponent { thresholds: [], unit: 'none', stat: 'avg', - theme: GrafanaThemeType.Dark, }; componentDidMount() { @@ -134,7 +133,7 @@ export class Gauge extends PureComponent { Math.min(dimension / 5, 100) * (formattedValue !== null ? this.getFontScale(formattedValue.length) : 1); const thresholdLabelFontSize = fontSize / 2.5; - const options = { + const options: any = { series: { gauges: { gauge: { diff --git a/public/app/core/components/jsontree/jsontree.ts b/public/app/core/components/jsontree/jsontree.ts index 4bcb2f632c2..a101007f129 100644 --- a/public/app/core/components/jsontree/jsontree.ts +++ b/public/app/core/components/jsontree/jsontree.ts @@ -10,13 +10,13 @@ coreModule.directive('jsonTree', [ startExpanded: '@', rootName: '@', }, - link: (scope, elem) => { + link: (scope: any, elem) => { const jsonExp = new JsonExplorer(scope.object, 3, { animateOpen: true, }); const html = jsonExp.render(true); - elem.html(html); + elem.replaceAll(html); }, }; }, diff --git a/yarn.lock b/yarn.lock index 0a3513595a8..c75b8e5a57b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1514,6 +1514,11 @@ react-input-autosize "^2.2.1" react-transition-group "^2.2.1" +"@types/angular@^1.6.6": + version "1.6.54" + resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.54.tgz#f9d5a03e4da7b021a6dabe5d63e899ed4567a5bd" + integrity sha512-xA1FuozWXeRQ7FClUbvk8ePL+dydBeDoCWRPFTHU5+8uvVtIIfLGiHA8CMkwsbddFCYnTDVbLxG85a/HBx7LtA== + "@types/chalk@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@types/chalk/-/chalk-2.2.0.tgz#b7f6e446f4511029ee8e3f43075fb5b73fbaa0ba"