Search code examples
typescripthighchartsvuejs3

Could not find a declaration file for module 'highcharts' in version 11.0.0 and forward


I am using Vue 3 with TypeScript and I am trying to import the types from highcharts with this line of code:

import * as Highcharts from 'highcharts'

If I use highcharts version 10.3.3 or prior, everything functions correctly. But from version 11.0.0 and onward it shows this error: Could not find a declaration file for module 'highcharts'. Am I doing something wrong or is the new version broken? I have also tested it with the latest version (11.1.0).

EDIT 2:

My config files seems to be irrelevant, since I started a new Vue 3 project from scratch by using Vite, imported highcharts and highcharts-vue packages and it still throws the same error. highcharts-vue works correctly, but the reqular highcharts is unable to find the module.

EDIT1:

Here are my config files:

(I deleted the config files since they were irrelevant)


Solution

  • This problem is caused in VSCode by the Volar extension which by default has 20MB as a default Max File Size for .vue files.

    To change that you should go to File -> Preferences -> Settings and change the Vue: Max File Size to a number above 25MB.

    This seems to solve the problem.