]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
types: Allow passing undefined for chart options (#11780)
authorJon Dufresne <jon.dufresne@gmail.com>
Tue, 21 May 2024 13:07:35 +0000 (06:07 -0700)
committerGitHub <noreply@github.com>
Tue, 21 May 2024 13:07:35 +0000 (09:07 -0400)
When exactOptionalPropertyTypes, TypeScript distinguishes between the
value undefined and the property not existing. See:

https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes

For Chart.js options, this difference is not important and either
passing undefined or not including it have the same effect.

src/types/index.d.ts

index 98bdf09a21251eef9e88d78e2a18eaf482c550b2..7a2c8a766e5aa55b78e7a1334ab2bc98bb75ff4f 100644 (file)
@@ -3815,7 +3815,7 @@ export interface ChartConfiguration<
 > {
   type: TType;
   data: ChartData<TType, TData, TLabel>;
-  options?: ChartOptions<TType>;
+  options?: ChartOptions<TType> | undefined;
   plugins?: Plugin<TType>[];
   platform?: typeof BasePlatform;
 }
@@ -3826,6 +3826,6 @@ export interface ChartConfigurationCustomTypesPerDataset<
   TLabel = unknown
 > {
   data: ChartDataCustomTypesPerDataset<TType, TData, TLabel>;
-  options?: ChartOptions<TType>;
+  options?: ChartOptions<TType> | undefined;
   plugins?: Plugin<TType>[];
 }