-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript definition for dataset and plugin options #105
Comments
@Laroosta can you share a minimal project that reproduces this issue and instructions to build it? |
@simonbrunel sure, here is a test project: npm i -g ionic Let me know if you have any issues getting the project going. Thanks in advance! |
@Laroosta Thanks! I will take a look to add a TypeScript definition for this project (inside this repository) but it may take a while to get it in and released. In the meantime, I think you can create a minimal definition file to prevent compilation errors, for example:
declare module 'chart.js' {
interface ChartDataSets {
datalabels?: any
}
}
///<reference path="chartjs-plugin-datalabels.d.ts" />
import { Component, OnInit, ViewChild, ElementRef } from "@angular/core";
// ... |
Hi Simon,
Thank you so much for taking the time to respond. I will use your
suggestion until the typing definitions get updated.
Kind regards
Leroux
…On Sun, 16 Dec 2018, 14:22 Simon Brunel ***@***.*** wrote:
@Laroosta <https://github.com/Laroosta> Thanks!
I will take a look to add a TypeScript definition for this project (inside
this repository) but it may take a while to get it in and released. In the
meantime, I think you can create a minimal definition file to prevent
compilation errors, for example:
/src/pages/homes/chartjs-plugin-datalabels.d.ts:
import { ChartDataSets } from "chart.js"
declare module 'chart.js' {
interface ChartDataSets {
datalabels?: any
}
}
/src/pages/homes/home.ts:
///<reference path="chartjs-plugin-datalabels.d.ts" />import { Component, OnInit, ViewChild, ElementRef } from ***@***.***/core";// ...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#105 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMilW7gRHgD26SQj5Qcwg6fwAchaaPofks5u5jsHgaJpZM4ZTj0T>
.
|
This would be very useful, is the v0.6.0 far from be released? EDIT: Would this be added to https://github.com/DefinitelyTyped/DefinitelyTyped/ like @types/chartjs-plugin-datalabels to be able to import it in TypeScript like: import { ChartDataLabels } from 'chartjs-plugin-datalabels';? |
v0.6.0 is about to be released (probably this week)
No, I don't (I don't use TypeScript myself)
I don't think so because it will conflict with the one in this repository. |
Version 0.6.0 has been released. |
Hi,
I'm currently getting typing errors when adding datalabels to a dataset, which is then preventing the app to compile.
If I manually add the datalabels properties in the @types/chart.js file, it works fine, but this is not a proper solutions, as one should not add specific properties to the chart.js typings library for a plugin.
For now I had to duplicate the chart.js typings and add them as a typeRoots to the project. This means that the typings need to maintained locally.
Does anyone know how this problem can be solved? Is it not possible to extend the chart.js typings and add the plugin specific properties?
The text was updated successfully, but these errors were encountered: