vue-chartjs icon indicating copy to clipboard operation
vue-chartjs copied to clipboard

[Bug]: "Property 'datasets' is missing in type 'Record<string, any>' but required in type 'ChartData<\"bar\", number[], unknown>'."

Open dagrimm opened this issue 3 years ago • 0 comments

Would you like to work on a fix?

  • [ ] Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Hey! I use exactly the example you provide on your documentation regarding the "Chart with props" case for Vue 3 with Vite and TypeScript.

VSCode version 1.68.1 Extension with Vue Language Features (Volar) v0.38.2

I have just slightly updated the code (see Gist link) for the Vue 3 Composition API. It works fine, but I get an error message in VSCode. Expected would be to have no error message:

"message": "Property 'datasets' is missing in type 'Record<string, any>' but required in type 'ChartData<\"bar\", number[], unknown>'.",
	"source": "ts",
	"startLineNumber": 2,
	"startColumn": 9,
	"endLineNumber": 2,
	"endColumn": 19,
	"relatedInformation": [
		{
			"startLineNumber": 3649,
			"startColumn": 3,
			"endLineNumber": 3649,
			"endColumn": 11,
			"message": "'datasets' is declared here.",
			"resource": "../../../../node_modules/chart.js/types/index.esm.d.ts"
		},
		{
			"startLineNumber": 9,
			"startColumn": 5,
			"endLineNumber": 9,
			"endColumn": 14,
			"message": "The expected type comes from property 'chartData' which is declared here on type 'IntrinsicAttributes & Partial<{}> & Omit<Readonly<IChartProps<\"bar\", number[], unknown>> & { \"onChart:rendered\"?: (() => any) | undefined; \"onChart:updated\"?: (() => any) | undefined; \"onChart:destroyed\"?: (() => any) | undefined; \"onLabels:updated\"?: (() => any) | undefined; } & VNodeProps & AllowedComponentProps &...'",
			"resource": "/../../../../node_modules/vue-chartjs/dist/types.d.ts"
		}
	]
}]

Reproduction

https://gist.github.com/dagrimm/9c76140c6ea01dd9bdac91a45aea0d0f

chart.js version

v3.8.0

vue-chartjs version

v3.1.8

Possible solution

No response

dagrimm avatar Jul 05 '22 17:07 dagrimm