Repository: League-of-Foundry-Developers/foundry-vtt-types
Pull request #3041 (2025-01-27 05:21:42)

Types and tests for `client/pixi/placeables/primary-canvas-objects/**`
as title


Patch:
diff --git a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts
index 72a6cb436..754e287d3 100644
--- a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts
+++ b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts
@@ -5,12 +5,21 @@ declare class PrimaryCanvasObject {
   /** @privateRemarks All mixin classses should accept anything for its constructor. */
   constructor(...args: any[]);
 
+  /**
+   * @defaultValue `true`
+   * @privateRemarks Actually an override of the property on `PIXI.DisplayObject`
+   */
+  cullable: boolean;
+
   /**
    * An optional reference to the object that owns this PCO.
    * This property does not affect the behavior of the PCO itself.
    * @defaultValue `null`
+   * @privateRemarks Foundry types as `*`, but in practice, it will only ever be a `Drawing` (via `PrimaryGraphics`),
+   * or a `Token`, `Tile`, or the `PrimaryCanvasGroup` (via `PrimarySpriteMesh`), or its default value `null`
    */
-  object: PlaceableObject | null;
+  //TODO: (esheyw) Revisit the "any canvas group" type when groups are done
+  object: PlaceableObject.Any | CanvasGroupMixin.Any | null;
 
   /**
    * The elevation of this object.
@@ -44,6 +53,7 @@ declare class PrimaryCanvasObject {
   /**
    * Event fired when this display object is added to a parent.
    * @param parent - The new parent container.
+   * @throws If `parent` is not `=== canvas.primary`
    */
   protected _onAdded(parent: PIXI.Container): void;
 
@@ -53,9 +63,11 @@ declare class PrimaryCanvasObject {
    */
   protected _onRemoved(parent: PIXI.Container): void;
 
+  /** @see {@link CanvasTransformMixinClass#updateCanvasTransform} */
   updateCanvasTransform(): void;
 
-  _onCanvasBoundsUpdate(): void;
+  /** @see {@link CanvasTransformMixinClass#_onCanvasBoundsUpdate} */
+  protected _onCanvasBoundsUpdate(): void;
 
   /**
    * Does this object render to the depth buffer?
@@ -65,7 +77,7 @@ declare class PrimaryCanvasObject {
   /**
    * Does this object render to the depth buffer?
    */
-  _shouldRenderDepth(): boolean;
+  protected _shouldRenderDepth(): boolean;
 
   /**
    * Render the depth of this object.
@@ -102,6 +114,7 @@ declare class CanvasTransformMixinClass {
 
   /**
    * The update ID of canvas transform matrix.
+   * @privateRemarks Foundry marked `@internal`, technically accessed externally via `this.parent._convasTranformID` in `updateCanvasTransform`
    */
   protected _canvasTransformID: number;
 
@@ -153,12 +166,15 @@ declare global {
    * A mixin which decorates a DisplayObject with additional properties expected for rendering in the PrimaryCanvasGroup.
    * @param DisplayObject - The parent DisplayObject class being mixed
    * @returns A DisplayObject subclass mixed with PrimaryCanvasObject features
+   * @privateRemarks Despite naming the argument "DisplayObject", it's typed as only taking `PIXI.Container`s, which matches core's usage
    */
-  function PrimaryCanvasObjectMixin<BaseClass extends PIXI.DisplayObject.AnyConstructor>(
+  function PrimaryCanvasObjectMixin<BaseClass extends PIXI.Container.AnyConstructor>(
     DisplayObject: BaseClass,
   ): Mixin<typeof PrimaryCanvasObject, ReturnType<typeof CanvasTransformMixin<BaseClass>>>;
 
   namespace PrimaryCanvasObjectMixin {
+    type AnyMixed = ReturnType<typeof PrimaryCanvasObjectMixin<PIXI.Container.AnyConstructor>>;
+
     type MixinClass = typeof PrimaryCanvasObject;
   }
 
@@ -166,12 +182,15 @@ declare global {
    * A mixin which decorates a DisplayObject with additional properties for canvas transforms and bounds.
    * @param DisplayObject - The parent DisplayObject class being mixed
    * @returns A DisplayObject subclass mixed with CanvasTransformMixin features
+   * @privateRemarks Despite naming the argument "DisplayObject", it's typed as only taking `PIXI.Container`s, which matches core's usage
    */
-  function CanvasTransformMixin<BaseClass extends PIXI.DisplayObject.AnyConstructor>(
+  function CanvasTransformMixin<BaseClass extends PIXI.Container.AnyConstructor>(
     DisplayObject: BaseClass,
   ): Mixin<typeof CanvasTransformMixinClass, BaseClass>;
 
   namespace CanvasTransformMixin {
+    type AnyMixed = ReturnType<typeof CanvasTransformMixin<PIXI.Container.AnyConstructor>>;
+
     type MixinClass = typeof CanvasTransformMixinClass;
   }
 }
diff --git a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts
index ae9ec7693..59d9873f4 100644
--- a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts
+++ b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts
@@ -1,4 +1,4 @@
-import type { InexactPartial } from "fvtt-types/utils";
+import type { NullishProps } from "fvtt-types/utils";
 
 declare global {
   /**
@@ -9,16 +9,10 @@ declare global {
      * @param options - A config object
      */
     constructor(
-      options?: InexactPartial<{
-        /** A geometry passed to the graphics. */
-        geometry: PIXI.GraphicsGeometry;
-
-        /** The name of the PCO. */
-        name: string;
-
-        /** Any object that owns this PCO. */
-        object: PlaceableObject;
-      }>,
+      /**
+       * @remarks Passing `null`, or an object where the `geometry` property is either missing or nullish, will result in an effective default of `new PIXI.GraphicsGeometry()`
+       */
+      options?: PIXI.GraphicsGeometry | PrimaryGraphics.ConstructorOptions | null,
     );
 
     override _calculateCanvasBounds(): void;
@@ -27,4 +21,40 @@ declare global {
 
     override containsCanvasPoint(point: PIXI.IPointData): boolean;
   }
+
+  namespace PrimaryGraphics {
+    interface Any extends AnyPrimaryGraphics {}
+    type AnyConstructor = typeof AnyPrimaryGraphics;
+
+    /** @internal */
+    type _ConstructorOptions = NullishProps<{
+      /**
+       * A geometry passed to the graphics.
+       * @defaultValue `new PIXI.GraphicsGeometry()`
+       * @remarks Default via calling `super(geometry)` with a falsey value
+       */
+      geometry: PIXI.GraphicsGeometry;
+
+      /**
+       * The name of the PCO.
+       * @defaultValue `null`
+       * @remarks Default via `?? null` in function body
+       * */
+      name: string;
+
+      /**
+       * Any object that owns this PCO.
+       * @defaultValue `null`
+       * @remarks Default via `?? null` in function body
+       * @privateRemarks Foundry types as `*`, but the only place they use this class is for `Drawing`s
+       */
+      object: PlaceableObject.Any;
+    }>;
+
+    interface ConstructorOptions extends _ConstructorOptions {}
+  }
+}
+
+declare abstract class AnyPrimaryGraphics extends PrimaryGraphics {
+  constructor(arg0: never, ...args: never[]);
 }
diff --git a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts
index a443a52fa..c7450911e 100644
--- a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts
+++ b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts
@@ -1,4 +1,4 @@
-import type { InexactPartial, Mixin } from "fvtt-types/utils";
+import type { Mixin, NullishProps } from "fvtt-types/utils";
 
 declare class PrimaryOccludableObject {
   /** @privateRemarks All mixin classses should accept anything for its constructor. */
@@ -20,7 +20,7 @@ declare class PrimaryOccludableObject {
    * The occlusion mode of this occludable object.
    * @defaultValue `CONST.OCCLUSION_MODES.NONE`
    */
-  occlusionMode: typeof CONST.OCCLUSION_MODES;
+  occlusionMode: CONST.OCCLUSION_MODES;
 
   /**
    * The unoccluded alpha of this object.
@@ -44,18 +44,40 @@ declare class PrimaryOccludableObject {
 
   /**
    * The amount of rendered FADE, RADIAL, and VISION occlusion.
+   * @defaultValue
+   * ```js
+   * {
+   *   fade: 0.0,
+   *   radial: 0.0,
+   *   vision: 0.0
+   * }
+   * ```
+   * @privateRemarks Foundry marked `@internal`
    */
-  protected _occlusionState: PrimaryOccludableObjectMixin.OcclusionState;
+  _occlusionState: PrimaryOccludableObjectMixin.OcclusionState;
 
   /**
    * The state of hover-fading.
-   */
-  protected _hoverFadeState: PrimaryOccludableObjectMixin.HoverFadeState;
+   * @defaultValue
+   * ```js
+   * {
+   *   hovered: false,
+   *   hoveredTime: 0,
+   *   faded: false,
+   *   fading: false,
+   *   fadingTime: 0,
+   *   occlusion: 0.0
+   * }
+   * ```
+   * @privateRemarks Foundry marked `@internal`
+   */
+  _hoverFadeState: PrimaryOccludableObjectMixin.HoverFadeState;
 
   /**
    * Get the blocking option bitmask value.
+   * @privateRemarks Foundry marked `@internal`
    */
-  protected get _restrictionState(): number;
+  get _restrictionState(): number;
 
   /**
    * Is this object blocking light?
@@ -81,12 +103,13 @@ declare class PrimaryOccludableObject {
    * change PCO appearance.
    * Uses a 50ms debounce threshold.
    * Objects which are in the hovered state remain occluded until their hovered state ends.
+   * @remarks Actually the return value of an arrow function passed to `foundry.utils.debounce` with a timeout of 50ms
    */
-  debounceSetOcclusion: (occluded: boolean) => void;
+  debounceSetOcclusion: (occluded: boolean) => boolean;
 
   updateCanvasTransform(): void;
 
-  _shouldRenderDepth: boolean;
+  _shouldRenderDepth(): boolean;
 
   /**
    * Test whether a specific Token occludes this PCO.
@@ -95,38 +118,55 @@ declare class PrimaryOccludableObject {
    * @param options - Additional options that affect testing
    * @returns Is the Token occluded by the PCO?
    */
-  testOcclusion(
-    token: Token,
-    options?: InexactPartial<{
-      /** Test corners of the hit-box in addition to the token center? */
-      corners: boolean;
-    }>,
-  ): boolean;
+  testOcclusion(token: Token.ConfiguredInstance, options?: PrimaryOccludableObjectMixin.TestOcclusionOptions): boolean;
 
   /**
    * @deprecated since v12, will be removed in v14
+   * @remarks "`#roof` is deprecated in favor of more granular options: `#restrictsLight` and `#restrictsWeather`"
    */
   get roof(): boolean;
 
+  /**
+   * @deprecated since v12, until v14
+   * @remarks "#roof is deprecated in favor of more granular options: #restrictsLight and #restrictsWeather"
+   */
+  set roof(enabled);
+
   /**
    * @deprecated since v12, will be removed in v14
+   * @remarks "#containsPixel is deprecated. Use #containsCanvasPoint instead."
    */
-  containsPixel(x: number, y: number, alphaThreshold: number): boolean;
+  containsPixel(x: number, y: number, alphaThreshold?: number): boolean;
 
   /**
    * @deprecated since v11, will be removed in v13
+   * @remarks "PrimaryCanvasObject#renderOcclusion is deprecated in favor of PrimaryCanvasObject#renderDepth"
    */
   renderOcclusion(renderer: PIXI.Renderer): void;
 }
 
 declare global {
-  function PrimaryOccludableObjectMixin<BaseClass extends PIXI.DisplayObject.AnyConstructor>(
+  function PrimaryOccludableObjectMixin<BaseClass extends PIXI.Container.AnyConstructor>(
     DisplayObject: BaseClass,
   ): Mixin<typeof PrimaryOccludableObject, ReturnType<typeof PrimaryCanvasObjectMixin<BaseClass>>>;
 
   namespace PrimaryOccludableObjectMixin {
+    type AnyMixed = ReturnType<typeof PrimaryOccludableObjectMixin<PIXI.Container.AnyConstructor>>;
+
     type MixinClass = typeof PrimaryOccludableObject;
 
+    /** @internal */
+    type _TestOcclusionOptions = NullishProps<{
+      /**
+       * Test corners of the hit-box in addition to the token center?
+       * @defaultValue `0`
+       */
+      corners: boolean;
+    }>;
+
+    /** Additional options that affect testing */
+    interface TestOcclusionOptions extends _TestOcclusionOptions {}
+
     interface OcclusionState {
       /** The amount of FADE occlusion */
       fade: number;
diff --git a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts
index 32b56753d..e2b32eb76 100644
--- a/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts
+++ b/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts
@@ -1,11 +1,4 @@
-import type { InexactPartial } from "fvtt-types/utils";
-
-// TODO: Remove when #2570 is completed
-declare const PrimaryBaseSamplerShader: BaseSamplerShader;
-
-declare namespace PrimaryBaseSamplerShader {
-  type AnyConstructor = unknown;
-}
+import type { InexactPartial, NullishProps } from "fvtt-types/utils";
 
 declare global {
   /**
@@ -13,30 +6,31 @@ declare global {
    */
   class PrimarySpriteMesh extends PrimaryOccludableObjectMixin(SpriteMesh) {
     constructor(
-      options?:
-        | InexactPartial<{
-            /** Texture passed to the SpriteMesh. */
-            texture: PIXI.Texture;
-
-            /** The shader class used to render this sprite. */
-            shaderClass: PrimaryBaseSamplerShader.AnyConstructor;
-
-            /** The name of this sprite. */
-            name: string;
-          }>
-        | PIXI.Texture,
-      shaderClass?: PrimaryBaseSamplerShader.AnyConstructor,
+      /**
+       * The constructor options.
+       * @defaultValue `{}`
+       * @remarks Default is applied if `options` is `instanceof PIXI.Texture`, or neither that nor `instanceof Object`
+       */
+      options?: PrimarySpriteMesh.ConstructorOptions | PIXI.Texture | null,
+      /**
+       * The shader class used to render this sprite.
+       * @defaultValue `PrimaryBaseSamplerShader`
+       * @remarks If `options` is an object, `options.shaderClass` takes precedence. If omitted,
+       * or if `options` is a `PIXI.Texture`, default is provided by `??` in function body.
+       */
+      shaderClass?: PrimaryBaseSamplerShader.AnyConstructor | null,
     );
 
     /**
      * The texture alpha data.
      */
-    _textureAlphaData: TextureLoader.TextureAlphaData | null;
+    protected _textureAlphaData: TextureLoader.TextureAlphaData | null;
 
     /**
      * The texture alpha threshold used for point containment tests.
      * If set to a value larger than 0, the texture alpha data is
      * extracted from the texture at 25% resolution.
+     * @defaultValue `0`
      */
     textureAlphaThreshold: number;
 
@@ -67,21 +61,9 @@ declare global {
      * @param baseWidth  - The base width used for computations.
      * @param baseHeight - The base height used for computations.
      * @param options    - The options.
+     * @throws If either `baseWidth` or `baseHeight` are less than 0, or if `options.fit` is not a FitType
      */
-    resize(
-      baseWidth: number,
-      baseHeight: number,
-      options?: InexactPartial<{
-        /** The fit type. */
-        fit: "fill" | "cover" | "contain" | "width" | "height";
-
-        /** The scale on X axis. */
-        scaleX: number;
-
-        /** The scale on Y axis. */
-        scaleY: number;
-      }>,
-    ): void;
+    resize(baseWidth: number, baseHeight: number, options?: PrimarySpriteMesh.ResizeOptions): void;
 
     protected override _updateBatchData(): void;
 
@@ -92,7 +74,22 @@ declare global {
      * @param point                 - The point in canvas space
      * @param textureAlphaThreshold - The minimum texture alpha required for containment
      */
-    containsCanvasPoint(point: PIXI.IPointData, textureAlphaThreshold?: number): boolean;
+    containsCanvasPoint(
+      point: PIXI.IPointData,
+      /** @defaultValue `this.textureAlphaThreshold` */
+      textureAlphaThreshold?: number,
+    ): boolean;
+
+    /**
+     * Is the given point in world space contained in this object?
+     * @param point                 - The point in world space
+     * @param textureAlphaThreshold - The minimum texture alpha required for containment
+     */
+    containsPoint(
+      point: PIXI.IPointData,
+      /** @defaultValue `this.textureAlphaThreshold` */
+      textureAlphaThreshold?: number,
+    ): boolean;
 
     override renderDepthData(renderer: PIXI.Renderer): void;
 
@@ -105,7 +102,93 @@ declare global {
 
     /**
      * @deprecated since v12, will be removed in v14
+     * @remarks "#getPixelAlpha is deprecated without replacement."
      */
     getPixelAlpha(x: number, y: number): number;
+
+    /**
+     * @deprecated since v12, until v14
+     * @remarks "#_getAlphaBounds is deprecated without replacement."
+     */
+    _getAlphaBounds(): PIXI.Rectangle;
+
+    /**
+     * @deprecated since v12, until v14
+     * @remarks "#_getTextureCoordinate is deprecated without replacement."
+     */
+    _getTextureCoordinate(testX: number, testY: number): PIXI.IPointData;
   }
+
+  namespace PrimarySpriteMesh {
+    interface Any extends AnyPrimarySpriteMesh {}
+    type AnyConstructor = typeof AnyPrimarySpriteMesh;
+
+    type FitType = "fill" | "cover" | "contain" | "width" | "height";
+
+    /** @internal */
+    type _ConstructorOptions = NullishProps<{
+      /**
+       * Texture passed to the SpriteMesh.
+       * @defaultValue `null`
+       * @remarks Default ultimately provided by the `SpriteMesh` constructor
+       */
+      texture: PIXI.Texture;
+
+      /**
+       * The shader class used to render this sprite.
+       * @defaultValue `PrimaryBaseSamplerShader`
+       * @remarks Default provided by `??=` in function body
+       */
+      shaderClass: PrimaryBaseSamplerShader.AnyConstructor;
+
+      /**
+       * The name of this sprite.
+       * @defaultValue `null`
+       * @remarks Default provided by `?? null` in function body
+       */
+      name: string;
+
+      /**
+       * Any object that owns this PCO.
+       * @defaultValue `null`
+       * @remarks Default via `?? null` in function body
+       * @privateRemarks Foundry types as `*`, but the only things passed in practice are `Tile`s, `Token`s, and the `PrimaryCanvasGroup`
+       */
+      //TODO: (esheyw) Revisit the "any canvas group" type when groups are done
+      object: PlaceableObject.Any | CanvasGroupMixin.Any;
+    }>;
+
+    /** The constructor options */
+    interface ConstructorOptions extends _ConstructorOptions {}
+
+    /** @internal */
+    type _ResizeOptions = InexactPartial<{
+      /**
+       * The fit type.
+       * @defaultValue `"fill"`
+       * @remarks Can't be `null` because it only has a parameter default, and is then fed into a switch statement where the default is throw
+       * */
+      fit: FitType;
+
+      /**
+       * The scale on X axis.
+       * @defaultValue `1`
+       * @remarks Can't be `null` because it only has a parameter default and a width scale of 0 is, if not nonsensical, not to be done by accident.
+       */
+      scaleX: number;
+
+      /**
+       * The scale on Y axis.
+       * @defaultValue `1`
+       * @remarks Can't be `null` because it only has a parameter default and a height scale of 0 is, if not nonsensical, not to be done by accident.
+       */
+      scaleY: number;
+    }>;
+
+    interface ResizeOptions extends _ResizeOptions {}
+  }
+}
+
+declare abstract class AnyPrimarySpriteMesh extends PrimarySpriteMesh {
+  constructor(arg0: never, ...args: never[]);
 }


Test patch:
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/drawing-shape.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/drawing-shape.test-d.ts
deleted file mode 100644
index 5bbbbe705..000000000
--- a/tests/foundry/client/pixi/placeables/primary-canvas-objects/drawing-shape.test-d.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-// TODO: After data model integration (also these are going away in v12)
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/occludable-object.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/occludable-object.test-d.ts
deleted file mode 100644
index 5bbbbe705..000000000
--- a/tests/foundry/client/pixi/placeables/primary-canvas-objects/occludable-object.test-d.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-// TODO: After data model integration (also these are going away in v12)
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.test-d.ts
index 5bbbbe705..21c83079e 100644
--- a/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.test-d.ts
+++ b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.test-d.ts
@@ -1,1 +1,13 @@
-// TODO: After data model integration (also these are going away in v12)
+import { expectTypeOf } from "vitest";
+
+const myCT = new (CanvasTransformMixin(PIXI.Container))();
+
+expectTypeOf(myCT.canvasBounds).toEqualTypeOf<PIXI.Rectangle>();
+expectTypeOf(myCT["_canvasBounds"]).toEqualTypeOf<PIXI.Bounds>();
+expectTypeOf(myCT.containsCanvasPoint({ x: 1000, y: 1000 })).toEqualTypeOf<boolean>();
+
+const myPCO = new (PrimaryCanvasObjectMixin(PIXI.Container))();
+declare const someRenderer: PIXI.Renderer;
+
+expectTypeOf(myPCO.sortLayer).toEqualTypeOf<number>();
+expectTypeOf(myPCO.renderDepthData(someRenderer)).toEqualTypeOf<void>();
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.test-d.ts
new file mode 100644
index 000000000..158b5b59f
--- /dev/null
+++ b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.test-d.ts
@@ -0,0 +1,15 @@
+import { expectTypeOf } from "vitest";
+
+declare const someToken: Token.ConfiguredInstance;
+declare const someGG: PIXI.GraphicsGeometry;
+
+let myPG = new PrimaryGraphics(someGG);
+myPG = new PrimaryGraphics(null);
+myPG = new PrimaryGraphics({
+  object: someToken,
+  name: "bob",
+  geometry: undefined,
+});
+
+expectTypeOf(myPG.containsCanvasPoint({ x: 500, y: 500 })).toEqualTypeOf<boolean>();
+expectTypeOf(myPG.cullable).toEqualTypeOf<boolean>();
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.test-d.ts
new file mode 100644
index 000000000..fde705fec
--- /dev/null
+++ b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.test-d.ts
@@ -0,0 +1,17 @@
+import { expectTypeOf } from "vitest";
+
+declare const someToken: Token.ConfiguredInstance;
+declare const someRenderer: PIXI.Renderer;
+
+const POOClass = PrimaryOccludableObjectMixin(PIXI.Container);
+const myPOO = new POOClass();
+
+expectTypeOf(myPOO.testOcclusion(someToken, { corners: true })).toEqualTypeOf<boolean>();
+expectTypeOf(myPOO.occlusionMode).toEqualTypeOf<foundry.CONST.OCCLUSION_MODES>();
+expectTypeOf(myPOO._restrictionState).toEqualTypeOf<number>();
+expectTypeOf(myPOO.debounceSetOcclusion(false)).toEqualTypeOf<boolean>();
+
+//deprecated until v13
+expectTypeOf(myPOO.renderOcclusion(someRenderer)).toEqualTypeOf<void>();
+//deprecated until v14
+expectTypeOf(myPOO.containsPixel(500, 500, 0.5)).toEqualTypeOf<boolean>();
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.test-d.ts
new file mode 100644
index 000000000..0d0a32431
--- /dev/null
+++ b/tests/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.test-d.ts
@@ -0,0 +1,26 @@
+import { expectTypeOf } from "vitest";
+
+declare const someTex: PIXI.Texture;
+
+let myPSM = new PrimarySpriteMesh(someTex, TokenRingSamplerShader);
+myPSM = new PrimarySpriteMesh({
+  texture: someTex,
+  shaderClass: TokenRingSamplerShader,
+  name: "doug",
+});
+
+expectTypeOf(myPSM["_textureAlphaData"]).toEqualTypeOf<TextureLoader.TextureAlphaData | null>();
+expectTypeOf(myPSM.setShaderClass(PrimaryBaseSamplerShader)).toEqualTypeOf<void>();
+expectTypeOf(
+  myPSM.resize(500, 500, {
+    fit: "cover",
+    scaleX: 2,
+    scaleY: 0.5,
+  }),
+).toEqualTypeOf<void>();
+expectTypeOf(myPSM.containsCanvasPoint({ x: 500, y: 500 }, 0.5)).toEqualTypeOf<boolean>();
+expectTypeOf(myPSM.containsPoint({ x: 500, y: 500 }, 0.2)).toEqualTypeOf<boolean>();
+// deprecated until v14
+expectTypeOf(myPSM.getPixelAlpha(500, 500)).toEqualTypeOf<number>();
+expectTypeOf(myPSM._getAlphaBounds()).toEqualTypeOf<PIXI.Rectangle>();
+expectTypeOf(myPSM._getTextureCoordinate(250, 250)).toEqualTypeOf<PIXI.IPointData>();
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/tile-mesh.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/tile-mesh.test-d.ts
deleted file mode 100644
index 5bbbbe705..000000000
--- a/tests/foundry/client/pixi/placeables/primary-canvas-objects/tile-mesh.test-d.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-// TODO: After data model integration (also these are going away in v12)
diff --git a/tests/foundry/client/pixi/placeables/primary-canvas-objects/token-mesh.test-d.ts b/tests/foundry/client/pixi/placeables/primary-canvas-objects/token-mesh.test-d.ts
deleted file mode 100644
index 5bbbbe705..000000000
--- a/tests/foundry/client/pixi/placeables/primary-canvas-objects/token-mesh.test-d.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-// TODO: After data model integration (also these are going away in v12)