Skip to content

TypeError: theme is not a function #401

Closed as not planned
Closed as not planned
@juanqui66

Description

@juanqui66

I have an ionic project with angular, and when refactoring to use the latest versions of ionic, angular 19 standalone and highcharts, it started giving me errors when using functions like theme.

import * as Highcharts from 'highcharts/highcharts';
import theme from 'highcharts/themes/dark-unica';

The call to theme(Highcharts) causes an error of the type:

TypeError: theme is not a function.

My code looks like this:

public initGraphs() {
		if (this.utils.darkMode()) {
			theme(Highcharts);
		}

		this.chartOptions = 
		{
                ...

Is it no longer possible to dynamically initialize dark mode dark-unica? How can

Setup used

Ionic:

Ionic CLI : 7.2.0 (C:\Users\juanc\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 8.5.1
@angular-devkit/build-angular : 19.2.4
@angular-devkit/schematics : 19.2.4
@angular/cli : 19.2.4
@ionic/angular-toolkit : 12.1.1

Capacitor:

Capacitor CLI : 7.1.0
@capacitor/android : not installed
@capacitor/core : 7.1.0
@capacitor/ios : not installed

Utility:

cordova-res : 0.15.4
native-run : 2.0.1

System:

NodeJS : v22.2.0 (C:\Program Files\nodejs\node.exe)
npm : 10.8.2
OS : Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions