From 2e675ef817e9e1433938fe7b1266caacc7eb19ae Mon Sep 17 00:00:00 2001 From: Hardy Jones Date: Sun, 15 Sep 2024 15:28:58 -0700 Subject: [PATCH] Use `GetDataReturnType` in `GridConfig` (#2797) * Use `GetDataReturnType` in `GridConfig` ## What issue does this pull request correspond to (if any)? Part of #2546 ## What does this pull request implement? We migrate `GridConfig#getData` to use `GetDataReturnType`. We're following the pattern laid out in the other subclasses of `Application`. ## What changes are made in this pull request? - Addition: Added `GridConfig.GridConfigData`. - Breaking: The return type of `GridConfig#getData` is more precise now. * Use `Scene.ConfiguredInstance` Since the `Scene` can be overridden and extended by package developers, we want to use a type that reflects what has been configured for the `Scene`, rather than what is statically defined here in this package. --- src/foundry/client/apps/forms/grid-config.d.mts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/foundry/client/apps/forms/grid-config.d.mts b/src/foundry/client/apps/forms/grid-config.d.mts index b4b48e459..e5858891f 100644 --- a/src/foundry/client/apps/forms/grid-config.d.mts +++ b/src/foundry/client/apps/forms/grid-config.d.mts @@ -1,5 +1,5 @@ import type { ConfiguredDocumentClass, InterfaceToObject } from "../../../../types/helperTypes.d.mts"; -import type { AnyObject, MaybePromise } from "../../../../types/utils.d.mts"; +import type { AnyObject, GetDataReturnType, MaybePromise } from "../../../../types/utils.d.mts"; declare global { /** @@ -38,7 +38,7 @@ declare global { protected override _render(force?: boolean, options?: Application.RenderOptions): Promise; - override getData(options?: Partial): MaybePromise; + override getData(options?: Partial): MaybePromise>; protected override _getSubmitData(updateData?: AnyObject | null): InterfaceToObject; @@ -134,5 +134,11 @@ declare global { "background.offsetX": Scene["background"]["offsetX"]; "background.offsetY": Scene["background"]["offsetY"]; } + + interface GridConfigData { + gridTypes: Record; + scale: number; + scene: Scene.ConfiguredInstance; + } } }