mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Update types so instance can be assigned to a variable of type Chart (#8525)
* Update types * Remove outdated comments
This commit is contained in:
parent
53ea370f5c
commit
bb82aaa320
5153
types/index.esm.d.ts
vendored
5153
types/index.esm.d.ts
vendored
File diff suppressed because it is too large
Load Diff
4
types/scriptable.d.ts
vendored
4
types/scriptable.d.ts
vendored
@ -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> };
|
||||
20
types/tests/test_instance_assignment.ts
Normal file
20
types/tests/test_instance_assignment.ts
Normal 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
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user