question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property 'type' is missing in type '{ name: string; data: any[]; }'

See original GitHub issue

Hi! I have a problem with Highcharts. Even with an example:

const c = new Chart({
  chart: {
   type: 'pie'
   },
    title: {
      text: 'TEST'
    },
    series: [
      {
         name: 'test',
         data: [1, 2, 3, 4, 5, 6]
      }
    ]
});

Visual Studio Code highlights series section with error: Property 'type' is missing in type '{ name: string; data: number[]; }' but required in type 'SeriesXrangeOptions'. I can’t do ng serve because of compilation errors. What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
troncomputerscommented, Jan 9, 2019

Workaround that works for me:

const c = new Chart({
  chart: {
   type: 'pie'
   },
    title: {
      text: 'TEST'
    },
    series: [
      {
         name: 'test',
         data: [1, 2, 3, 4, 5, 6],
         type: undefined
      }
    ]
});

You have to declare a type of series. Now everything works fine.

2reactions
web-feliconscommented, Feb 5, 2019

Workaround that works for me:

const c = new Chart({
  chart: {
   type: 'pie'
   },
    title: {
      text: 'TEST'
    },
    series: [
      {
         name: 'test',
         data: [1, 2, 3, 4, 5, 6],
         type: undefined
      }
    ]
});

You have to declare a type of series. Now everything works fine.

I can confirm this workaround works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

error TS2741: Property is missing in type - Stack Overflow
ERROR in services/user.service.ts(7,2): error TS2741: Property 'isEqual' is missing in type '{ firstName: string; lastName: string;}' but ...
Read more >
Property is missing in type 'X' but required in type 'Y' | bobbyhadz
The TypeScript error "Property is missing in type but required in type" occurs when we do not set all of the properties an...
Read more >
Typescript Type System: How Does it Really Work? Type ...
A key thing about the Typescript Type System is that most of the times it just works, but sometimes we get some surprising...
Read more >
Documentation - Utility Types - TypeScript
Constructs an object type whose property keys are Keys and whose property values are Type . This utility can be used to map...
Read more >
15 Typescript Mistakes To Avoid - SoftwareMill Tech Blog
This is another way that lets any type creep into our code. We would like to iterate over object properties: interface Dog {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found