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.

[Typescript + vue-class style components] Argument of type 'typeof UsageChart' is not assignable to parameter of type 'VueClass<Vue>'

See original GitHub issue

Hello. I’m having an issue using the typescript sample that’s in the docs. The compiler complains about types. Any ideas how can I fix this?

The code:

image

Full error:

Argument of type 'typeof UsageChart' is not assignable to parameter of type 'VueClass<Vue>'. Type 'typeof UsageChart' is not assignable to type 'VueConstructor<Vue>'. Types of parameters 'options' and 'options' are incompatible. Type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>> | undefined' is not assignable to type 'ThisTypedComponentOptionsWithArrayProps<Vue, Line, object, object, never> | undefined'. Type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>>' is not assignable to type 'ThisTypedComponentOptionsWithArrayProps<Vue, Line, object, object, never>'. Type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>>' is not assignable to type 'ComponentOptions<Vue, DataDef<Line, Record<never, any>, Vue>, object, object, never[], Record<never, any>>'. Type 'DefaultData<Vue>' is not assignable to type 'DataDef<Line, Record<never, any>, Vue>'. Type 'object' is not assignable to type 'DataDef<Line, Record<never, any>, Vue>'. Type 'object' is not assignable to type '(this: Readonly<Record<never, any>> & Vue) => Line'. Type '{}' provides no match for the signature '(this: Readonly<Record<never, any>> & Vue): Line'.ts(2345)

Environment

  • vue.js version: 2.6.8
  • vue-chart.js version: 3.4.2
  • npm version: 6.8.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
Djalercommented, May 5, 2019

You should use it like this:

<script lang="ts">
import { Bar } from 'vue-chartjs';
import { Component, Vue } from 'vue-property-decorator';

@Component({
  extends: Bar,
})
export default class CommitChart extends Bar {
}
</script>
6reactions
RCVZcommented, Aug 1, 2019

The solution that worked for me is to extend the vue Mixins , like in the example below.

</script>
export default class DoughnutChart extends Mixins(Doughnut) {
}
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

20 - Stack Overflow
Error in Vue3 - Argument of type 'typeof import("../dist/vue")' is not assignable to parameter of type 'PublicAPIComponent' · typescript · vue.js.
Read more >
TypeScript - Emotion
These definitions infer types for css properties with the object syntax, ... css({ ^ Argument of type 'boxSizing: 'bordre-box';' is not assignable [....
Read more >
Styled-component type error. : r/reactjs - Reddit
Argument of type 'typeof Calendar' is not assignable to parameter of type 'AnyStyledComponent'. Type 'typeof Calendar' is not assignable to ...
Read more >
Styled Components & TypeScript - | The Mindless
Listing down some of them here. 1. Installing the types. Styled Components library does not ship with types. Instead we have to install...
Read more >
Question about vue-class-component and component types
Hello, first post here so I hope someone can help me. Second, I apologize for not putting this onto JSFiddle or another code...
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