Merge pull request #15454 from influxdata/fix/upgrade-typescript

chore: upgrade typescript
pull/15443/head^2
Andrew Watkins 2019-10-17 12:50:21 -07:00 committed by GitHub
commit ca1cc04ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 36 deletions

View File

@ -113,7 +113,7 @@
"ts-loader": "^5.3.3",
"ts-node": "^8.3.0",
"tslib": "^1.9.0",
"typescript": "3.3.3",
"typescript": "3.6.4",
"webpack": "^4.37.0",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2",

View File

@ -72,19 +72,13 @@ const updateMaxWidths = (
const maxWidths = fastReduce<string>(
row,
(acc: ColumnWidths, col: string, c: number) => {
const isLabel =
(verticalTimeAxis && isTopRow) || (!verticalTimeAxis && c === 0)
const foundField = fieldOptions.find(field => field.internalName === col)
const foundField =
isLabel && _.isString(col)
? fieldOptions.find(field => field.internalName === col)
: null
let colValue = `${col}`
let colValue: string | number = `${col}`
if (foundField && foundField.displayName) {
colValue = foundField.displayName
} else if (_.isNumber(col) && decimalPlaces.isEnforced) {
colValue = col.toFixed(decimalPlaces.digits)
} else if (!isNaN(+col) && decimalPlaces.isEnforced) {
colValue = (+col).toFixed(decimalPlaces.digits)
}
const columnLabel = topRow[c]

View File

@ -58,7 +58,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputCpu.NameEnum.Cpu,
type: TelegrafPluginInputCpu.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -67,7 +66,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputDisk.NameEnum.Disk,
type: TelegrafPluginInputDisk.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -76,7 +74,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputDiskio.NameEnum.Diskio,
type: TelegrafPluginInputDiskio.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -112,7 +109,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputKernel.NameEnum.Kernel,
type: TelegrafPluginInputDiskio.TypeEnum.Input,
config: {},
},
},
[TelegrafPluginInputKubernetes.NameEnum.Kubernetes]: {
@ -142,7 +138,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputMem.NameEnum.Mem,
type: TelegrafPluginInputMem.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -151,7 +146,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputNet.NameEnum.Net,
type: TelegrafPluginInputNet.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -160,7 +154,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputNetResponse.NameEnum.NetResponse,
type: TelegrafPluginInputNetResponse.TypeEnum.Input,
config: {},
},
},
[TelegrafPluginInputNginx.NameEnum.Nginx]: {
@ -168,7 +161,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputNginx.NameEnum.Nginx,
type: TelegrafPluginInputNginx.TypeEnum.Input,
config: {urls: []},
},
templateID: '0000000000000006',
},
@ -177,7 +169,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputProcesses.NameEnum.Processes,
type: TelegrafPluginInputProcesses.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -222,7 +213,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputSwap.NameEnum.Swap,
type: TelegrafPluginInputSwap.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -231,7 +221,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputSystem.NameEnum.System,
type: TelegrafPluginInputSystem.TypeEnum.Input,
config: {},
},
templateID: '0000000000000009',
},
@ -240,7 +229,6 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
defaults: {
name: TelegrafPluginInputTail.NameEnum.Tail,
type: TelegrafPluginInputTail.TypeEnum.Input,
config: {},
},
},
}

View File

@ -41,7 +41,7 @@ export const isPluginUniqueToBundle = (
bundle: BundleName,
bundles: BundleName[]
): boolean => {
return bundles.reduce((acc, b) => {
return bundles.reduce((acc: boolean, b) => {
if (b === bundle) {
return acc
}

View File

@ -202,11 +202,11 @@ class TableCell extends PureComponent<Props> {
}
if (
_.isNumber(data) &&
!isNaN(+data) &&
decimalPlaces.isEnforced &&
decimalPlaces.digits < 100
) {
return data.toFixed(decimalPlaces.digits)
return (+data).toFixed(decimalPlaces.digits)
}
return _.defaultTo(data, '').toString()

View File

@ -92,11 +92,11 @@ export default class CSVTemplateBuilder extends PureComponent<Props, State> {
this.setState({csv})
}
private getUniqueValuesFromCSV(csv: string) {
private getUniqueValuesFromCSV(csv: string): string[] {
const parsedTVS = Papa.parse(csv)
const templateValuesData: string[][] = _.get(parsedTVS, 'data', [[]])
const valueSet = new Set()
const valueSet: Set<string> = new Set()
for (const row of templateValuesData) {
for (const value of row) {
const trimmedValue = trimAndRemoveQuotes(value)

View File

@ -93,7 +93,7 @@ const getVarChildren = (
*/
const collectAncestors = (
node: VariableNode,
acc = new Set()
acc: Set<VariableNode> = new Set()
): VariableNode[] => {
for (const parent of node.parents) {
if (!acc.has(parent)) {
@ -119,7 +119,7 @@ const findSubgraph = (
graph: VariableNode[],
variables: Variable[]
): VariableNode[] => {
const subgraph = new Set()
const subgraph: Set<VariableNode> = new Set()
for (const node of graph) {
const shouldKeep =
@ -204,7 +204,7 @@ const constVariableValues = (
*/
export const collectDescendants = (
node: VariableNode,
acc = new Set()
acc: Set<VariableNode> = new Set()
): VariableNode[] => {
for (const child of node.children) {
if (!acc.has(child)) {

View File

@ -36,7 +36,7 @@ export const csvToMap = (csv: string): MapResult => {
return {values, errors}
}
export const trimAndRemoveQuotes = elt => {
export const trimAndRemoveQuotes = (elt: string): string => {
const trimmed = elt.trim()
const dequoted = trimmed.replace(/(^")|("$)/g, '')

View File

@ -11868,10 +11868,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
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==
typescript@3.6.4:
version "3.6.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d"
integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==
ua-parser-js@^0.7.18:
version "0.7.18"