mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[chart.js] Add return type null to NestedTickOptions callback (#43143)
* [chart.js] Add return type null to NestedTickOptions callback * [chart.js] Add undefined as callback return value
This commit is contained in:
@@ -68,7 +68,21 @@ const chart: Chart = new Chart(ctx, {
|
||||
xAxes: [
|
||||
{
|
||||
ticks: {
|
||||
callback: Math.floor,
|
||||
callback: (value) => {
|
||||
if (value === 10) {
|
||||
return Math.floor(value);
|
||||
}
|
||||
|
||||
if (value === 20) {
|
||||
return `${value}`;
|
||||
}
|
||||
|
||||
if (value === 30) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
sampleSize: 10,
|
||||
},
|
||||
gridLines: {
|
||||
|
||||
5
types/chart.js/index.d.ts
vendored
5
types/chart.js/index.d.ts
vendored
@@ -562,7 +562,10 @@ declare namespace Chart {
|
||||
backdropPaddingX?: number;
|
||||
backdropPaddingY?: number;
|
||||
beginAtZero?: boolean;
|
||||
callback?(value: any, index: any, values: any): string | number;
|
||||
/**
|
||||
* If the callback returns null or undefined the associated grid line will be hidden.
|
||||
*/
|
||||
callback?(value: number | string, index: number, values: number[] | string[]): string | number | null | undefined;
|
||||
display?: boolean;
|
||||
fontColor?: ChartColor;
|
||||
fontFamily?: string;
|
||||
|
||||
Reference in New Issue
Block a user