Update types so instance can be assigned to a variable of type Chart (#8525)

* Update types
* Remove outdated comments
This commit is contained in:
Jukka Kurkela 2021-02-26 02:06:32 +02:00 committed by GitHub
parent 53ea370f5c
commit bb82aaa320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2595 additions and 2582 deletions

5153
types/index.esm.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
export type Scriptable<T, TContext> = T | ((ctx: TContext) => T);
export type ScriptableOptions<T, TContext> = { [P in keyof T]: Scriptable<T[P], TContext> };
export type ScriptableAndArray<T, TContext> = readonly T[] | Scriptable<T, TContext>;
export type ScriptableAndArrayOptions<T, TContext> = { [P in keyof T]: ScriptableAndArray<T[P], TContext> };

View File

@ -0,0 +1,20 @@
import { Chart } from '../index.esm';
const chart = new Chart('id', {
type: 'scatter',
data: {
labels: [],
datasets: [{
data: [],
pointRadius: (ctx) => ctx.parsed.x,
}]
},
});
interface Context {
chart: Chart;
}
export const ctx: Context = {
chart: chart
};