GithubHelp home page GithubHelp logo

Comments (10)

denchen avatar denchen commented on July 21, 2024 1

Since we've split the .d.ts files (see: #20727) that is probably correct.

Okay, this led me to figure out how to to get it working by basically having to explicitly import the SeriesLineOptions and SeriesColumnOptions types:

import type { SeriesColumnOptions, SeriesLineOptions } from 'highcharts';

const series: Array<
  | Highcharts.SeriesAreaOptions
  | SeriesColumnOptions
  | SeriesLineOptions
  | Highcharts.SeriesSplineOptions
> = [];

Though this works, I'm not sure why I have to explicitly import those particular types when I could use the globally available Highcharts to use SeriesAreaOptions & SeriesSplineOptions. In fact, I'm not even sure why / how a global Highcharts is available since I don't have anything explicit in my tsconfig.json to do so.

from highcharts.

karolkolodziej avatar karolkolodziej commented on July 21, 2024

Hi @denchen!

Can you please walk me through how to recreate that?
I've tried with the latest version and I don't get any errors- see the demo.

As you can see this interface exists here with v11.4.1
image

from highcharts.

denchen avatar denchen commented on July 21, 2024

Yeah, I see that exact line in node_modules/highcharts/highcharts.d.ts on 11.4.0, but I don't see it on 11.4.1

For 11.4.0, the file size is:

$ ls -l node_modules/highcharts/highcharts.d.ts
-rw-r--r--  1 denchen  staff  23029484 Apr  5 00:25 node_modules/highcharts/highcharts.d.ts

For 11.4.1, the file size is:

$ npm install [email protected] --save-dev

changed 1 package, and audited 2376 packages in 2s
16 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ ls -l node_modules/highcharts/highcharts.d.ts
-rw-r--r--  1 denchen  staff  3735521 Apr  5 00:28 node_modules/highcharts/highcharts.d.ts

So around 1/7th the size.

from highcharts.

karolkolodziej avatar karolkolodziej commented on July 21, 2024

Since we've split the .d.ts files (see: #20727) that is probably correct.

Can you please help me recreate that?
Probably the tsconfig and the way you import and resolve modules matter.

from highcharts.

rbirkgit avatar rbirkgit commented on July 21, 2024

I updated to 11.4.1 and our project now gets error missing Highcharts.SeriesPieOptions

We used to only need to import

import Highcharts from 'highcharts/es-modules/masters/highcharts.src';

Not sure what to import now. I cannot find it defined anywhere in the es-modules folder.

from highcharts.

bre1470 avatar bre1470 commented on July 21, 2024

@rbirkgit
These types are not expected to be missing. Maybe your editor needs to reload the project.

You can try to import to explicitly set types to the Highcharts namespace:

import 'highcharts/options/pie.src';

Alternative might be to access the type via registry:

type SeriesPieOptions = Highcharts.SeriesOptionsRegistry['SeriesPieOptions'];

If no workaround helps, please share your project configuration, so we can try to replicate the issue.

from highcharts.

bre1470 avatar bre1470 commented on July 21, 2024

@denchen

In fact, I'm not even sure why / how a global Highcharts is available since I don't have anything explicit in my tsconfig.json to do so.

The import of the Highcharts master creates a global namespace of itself for shared typing between multiple modules. This is just for easier access of types, but not necessarily available during runtime. It is recommended to access types via regular imports with named members.

from highcharts.

rbirkgit avatar rbirkgit commented on July 21, 2024

We get error on compile, so it's not an editor issue.

All we have is this import (to use ESM)

import Highcharts from 'highcharts/es-modules/masters/highcharts.src';

Then in our code:

export const DONUT_CHART_SERIES_BASE: Highcharts.SeriesPieOptions = {
  type: 'pie',
  data: []
};

This is the error:

Error: apps/accounts-and-resources/src/app/accounts-and-resources/highcharts.constants.ts:52:50 - error TS2724: '"D:/Git/cloud-ui/node_modules/highcharts/highcharts"' has no exported member named 'SeriesPieOptions'. Did you mean 'SeriesOptions'?

      52 export const DONUT_CHART_SERIES_BASE: Highcharts.SeriesPieOptions = {
                                                          ~~~~~~~~~~~~~~~~



from highcharts.

rbirkgit avatar rbirkgit commented on July 21, 2024

I opened a separate issue for my problem here: #20986

Lets' switch to there to keep this thread about the original issue.

from highcharts.

hubertkozik avatar hubertkozik commented on July 21, 2024

Thank you all. From what I can see all of the issues here are resolved. Closing as not a bug for now.

from highcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.