I have this typescript code:

private createCsvHeader(seriesIndexes: number[], graphSeries: ZingchartSeries[], scaleXTitle: string): string[] { let csvHeader: string[]; //if dataCsvTitle is populated (used for long header titles), then use that title so that it is not truncated in the CSV file, otherwise use the text property. graphSeries.forEach(item => { if (graphSeries.some(item => 'data-csvTitle' in item)) { csvHeader = [scaleXTitle as string, ...(seriesIndexes.map(i => graphSeries[i]['data-csvTitle']) as string[]) as string[]] as string[]; } else { csvHeader = [scaleXTitle, ...seriesIndexes.map(i => graphSeries[i].text)]; } }); return csvHeader; } }

I am getting the 'Unsafe return of an any typed value' when running ESLint. The error points to this line:

csvHeader = [scaleXTitle as string, ...(seriesIndexes.map(i => graphSeries[i]['data-csvTitle'])

As you can see, I tried casting everything to string[] on that line like crazy hoping the error would go away. I also did restart ESLint and my IntelliJ IDE so it doesn't seem to be a cache issue. Any ideas? Thanks.

ray805's user avatar

2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.