Repository: League-of-Foundry-Developers/foundry-vtt-types
Pull request #3050 (2025-02-01 00:08:54)

Pixi core containers other than CanvasGroupMixin
Types touchup and tests for title


Patch:
diff --git a/src/configuration/globals.d.mts b/src/configuration/globals.d.mts
index 98edeec10..025772eab 100644
--- a/src/configuration/globals.d.mts
+++ b/src/configuration/globals.d.mts
@@ -154,7 +154,7 @@ export import ForceGridColorationShader = globalThis.ForceGridColorationShader;
 export import FormApplication = globalThis.FormApplication;
 export import FrameViewer = globalThis.FrameViewer;
 export import FramebufferSnapshot = globalThis.FramebufferSnapshot;
-export import FullCanvasObject = globalThis.FullCanvasObject;
+export import FullCanvasObjectMixin = globalThis.FullCanvasObjectMixin;
 export import Game = globalThis.Game;
 export import GameTime = globalThis.GameTime;
 export import GamepadManager = globalThis.GamepadManager;
diff --git a/src/foundry/client/pixi/core/containers/cached-container.d.mts b/src/foundry/client/pixi/core/containers/cached-container.d.mts
index 99d9278c2..dd4ff015f 100644
--- a/src/foundry/client/pixi/core/containers/cached-container.d.mts
+++ b/src/foundry/client/pixi/core/containers/cached-container.d.mts
@@ -1,7 +1,5 @@
 import type { NullishProps } from "fvtt-types/utils";
 
-export {};
-
 declare global {
   /**
    * A special type of PIXI.Container which draws its contents to a cached RenderTexture.
@@ -12,17 +10,13 @@ declare global {
      * Construct a CachedContainer.
      * @param sprite - A specific sprite to bind to this CachedContainer and its renderTexture.
      */
-    constructor(sprite: PIXI.Sprite | SpriteMesh);
+    constructor(sprite?: PIXI.Sprite | SpriteMesh);
 
     /**
      * The texture configuration to use for this cached container
-     * @remarks Foundry marked as abstract
+     * @remarks Foundry marked as `@abstract`
      */
-    static textureConfiguration: NullishProps<{
-      multisample: PIXI.MSAA_QUALITY;
-      scaleMode: PIXI.SCALE_MODES;
-      format: PIXI.FORMATS;
-    }>;
+    static textureConfiguration: CachedContainer.TextureConfiguration;
 
     /**
      * A map of render textures, linked to their render function and an optional RGBA clear color.
@@ -33,7 +27,7 @@ declare global {
      * An RGBA array used to define the clear color of the RenderTexture
      * @defaultValue `[0, 0, 0, 1]`
      */
-    clearColor: [r: number, g: number, b: number, a: number];
+    clearColor: Color.RGBAColorVector;
 
     /**
      * Should our Container also be displayed on screen, in addition to being drawn to the cached RenderTexture?
@@ -65,10 +59,13 @@ declare global {
      */
     set alphaMode(mode: PIXI.ALPHA_MODES);
 
+    /** @remarks Foundry provides no getter, this is for accurate typing only, as without it Typescript would infer the type as `PIXI.ALPHA_MODES` */
+    get alphaMode(): undefined;
+
     /**
      * A bound Sprite which uses this container's render texture
      */
-    get sprite(): PIXI.Sprite | SpriteMesh;
+    get sprite(): PIXI.Sprite | SpriteMesh | undefined;
 
     set sprite(sprite: PIXI.Sprite | SpriteMesh);
 
@@ -85,7 +82,7 @@ declare global {
      * @param destroy - Should the render texture be destroyed?
      *                  (default: `true`)
      */
-    removeRenderTexture(renderTexture: PIXI.RenderTexture, destroy?: boolean): void;
+    removeRenderTexture(renderTexture: PIXI.RenderTexture, destroy?: boolean | null): void;
 
     /**
      * Clear the cached container, removing its current contents.
@@ -95,7 +92,7 @@ declare global {
      */
     clear(destroy?: boolean): CachedContainer | void;
 
-    override destroy(options?: boolean | PIXI.IDestroyOptions): void;
+    override destroy(options?: PIXI.IDestroyOptions | boolean): void;
 
     override render(renderer: PIXI.Renderer): void;
 
@@ -108,11 +105,32 @@ declare global {
   }
 
   namespace CachedContainer {
-    interface RenderOptions {
+    interface Any extends AnyCachedContainer {}
+    type AnyConstructor = typeof AnyCachedContainer;
+
+    /** @internal */
+    type _TextureConfiguration = NullishProps<{
+      multisample: PIXI.MSAA_QUALITY;
+      scaleMode: PIXI.SCALE_MODES;
+      format: PIXI.FORMATS;
+      /** @privateRemarks Only exists on DarknessLevelContainer and is seemingly unused there */
+      mipmap: PIXI.MIPMAP_MODES;
+    }>;
+
+    interface TextureConfiguration extends _TextureConfiguration {}
+
+    /** @internal */
+    type _RenderOptions = NullishProps<{
       /** Render function that will be called to render into the RT. */
-      renderFunction?: (renderer: PIXI.Renderer) => void;
+      renderFunction: (renderer: PIXI.Renderer) => void;
+
       /** An optional clear color to clear the RT before rendering into it. */
-      clearColor?: number[];
-    }
+      clearColor: Color.RGBAColorVector;
+    }>;
+    interface RenderOptions extends _RenderOptions {}
   }
 }
+
+declare abstract class AnyCachedContainer extends CachedContainer {
+  constructor(arg0: never, ...args: never[]);
+}
diff --git a/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts b/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts
index aac4fe405..d9a7fa1fb 100644
--- a/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts
+++ b/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts
@@ -4,7 +4,7 @@ declare class FullCanvasObject {
   /** @privateRemarks All mixin classses should accept anything for its constructor. */
   constructor(...args: any[]);
 
-  /** @remarks Overrides the mixed in class */
+  /** @remarks Overrides the mixed PIXI class's method, @see {@link PIXI.DisplayObject#calculateBounds} */
   calculateBounds(): void;
 }
 
@@ -15,19 +15,23 @@ declare global {
    * @param Base - Any PIXI DisplayObject subclass
    * @returns The decorated subclass with full canvas bounds
    */
-  function FullCanvasObjectMixin<BaseClass extends FullCanvasObject.BaseClass>(
+  function FullCanvasObjectMixin<BaseClass extends FullCanvasObjectMixin.BaseClass>(
     Base: BaseClass,
   ): Mixin<typeof FullCanvasObject, BaseClass>;
 
-  namespace FullCanvasObject {
+  namespace FullCanvasObjectMixin {
+    interface Any extends AnyFullCanvasObject {}
     type AnyConstructor = typeof AnyFullCanvasObject;
 
+    type AnyMixedConstructor = ReturnType<typeof FullCanvasObjectMixin<BaseClass>>;
+    interface AnyMixed extends AnyMixedConstructor {}
+
     type BaseClass = PIXI.DisplayObject.AnyConstructor;
   }
 
   /**
    * @deprecated since v11, will be removed in v13
-   * @remarks You are using the FullCanvasContainer class which has been deprecated in favor of a more flexible FullCanvasObjectMixin which can augment any PIXI.DisplayObject subclass.
+   * @remarks "You are using the FullCanvasContainer class which has been deprecated in favor of a more flexible FullCanvasObjectMixin which can augment any PIXI.DisplayObject subclass."
    */
   class FullCanvasContainer extends FullCanvasObjectMixin(PIXI.Container) {}
 }
diff --git a/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts b/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts
index 4ddeecf12..be67850ed 100644
--- a/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts
+++ b/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts
@@ -3,24 +3,25 @@ export {};
 declare global {
   /**
    * Extension of a PIXI.Mesh, with the capabilities to provide a snapshot of the framebuffer.
+   * @remarks Foundry only uses this with `AdaptiveLightingShader` subclasses, thus the type param default
    */
-  class PointSourceMesh extends PIXI.Mesh {
+  class PointSourceMesh<Shader extends PIXI.Shader = AdaptiveLightingShader> extends PIXI.Mesh<Shader> {
     /**
-     * @remarks This override is not in the actual Foundry code, this is reflecting actual usage.
-     * PIXI.Mesh asks for a PIXI.MeshMaterial for its second argument, a subclass of PIXI.Shader.
-     * But foundry doesn't use those additional properties, so in actual practice it just needs PIXI.Shader.
+     * @remarks This override is not in the actual Foundry code, it's just to sync up the Shader type param with super
      */
-    constructor(geometry: PIXI.Geometry, shader: PIXI.Shader, state?: PIXI.State, drawMode?: PIXI.DRAW_MODES);
+    constructor(geometry: PIXI.Geometry, shader: Shader, state?: PIXI.State, drawMode?: PIXI.DRAW_MODES);
 
     /**
      * To store the previous blend mode of the last renderer PointSourceMesh.
+     * @privateRemarks Despite being `protected`, this is accessed externally in `CanvasIlluminationEffects#render`
      */
-    protected static _priorBlendMode: PIXI.BLEND_MODES;
+    protected static _priorBlendMode: PIXI.BLEND_MODES | undefined;
 
     /**
      * The current texture used by the mesh.
+     * @privateRemarks Despite being `protected`, this is accessed externally in `CanvasIlluminationEffects#render`
      */
-    protected static _currentTexture: PIXI.Texture;
+    protected static _currentTexture: PIXI.Texture | undefined;
 
     /**
      * The transform world ID of the bounds.
@@ -44,12 +45,6 @@ declare global {
     /** @throws You can't add children to a PointSourceMesh. */
     override addChildAt(): never;
 
-    /**
-     * @throws You can't add children to a PointSourceMesh.
-     * @privateRemarks This method is meant to be an override, but the PIXI.Mesh class does not have an addChildren() method
-     */
-    addChildren(): never;
-
     protected override _render(renderer: PIXI.Renderer): void;
 
     override calculateBounds(): void;
@@ -57,6 +52,21 @@ declare global {
     protected override _calculateBounds(): void;
 
     /** The local bounds need to be drawn from the underlying geometry. */
-    override getLocalBounds(rect?: PIXI.Rectangle): PIXI.Rectangle;
+    override getLocalBounds(
+      /**
+       * @defaultValue `new PIXI.Rectangle()`
+       * @remarks Default provided by `??=` in function body. `null` would be allowable here but breaks inheritance
+       */
+      rect?: PIXI.Rectangle,
+    ): PIXI.Rectangle;
   }
+
+  namespace PointSourceMesh {
+    interface Any extends AnyPointSourceMesh {}
+    type AnyConstructor = typeof AnyPointSourceMesh;
+  }
+}
+
+declare abstract class AnyPointSourceMesh extends PointSourceMesh<PIXI.Shader.Any> {
+  constructor(arg0: never, ...args: never[]);
 }
diff --git a/src/foundry/client/pixi/core/containers/quad-mesh.d.mts b/src/foundry/client/pixi/core/containers/quad-mesh.d.mts
index f1240261c..7779e940b 100644
--- a/src/foundry/client/pixi/core/containers/quad-mesh.d.mts
+++ b/src/foundry/client/pixi/core/containers/quad-mesh.d.mts
@@ -4,12 +4,13 @@ declare global {
   /**
    * A basic rectangular mesh with a shader only. Does not natively handle textures (but a bound shader can).
    * Bounds calculations are simplified and the geometry does not need to handle texture coords.
+   * @privateRemarks Ideally the `shaderClass` passed to the constructor and `get shader()` could be synced up, but `setShaderClass` removes that option
    */
   class QuadMesh extends PIXI.Container {
     /**
      * @param shaderClass - The shader class to use.
      */
-    constructor(shaderClass: typeof AbstractBaseShader);
+    constructor(shaderClass: AbstractBaseShader.AnyConstructor);
 
     /**
      * The shader bound to this mesh.
@@ -21,15 +22,15 @@ declare global {
      */
     get blendMode(): PIXI.BLEND_MODES;
 
-    set blendMode(value: PIXI.BLEND_MODES);
+    set blendMode(value);
 
     /**
      * Initialize shader based on the shader class type.
      * @param shaderClass - Shader class used. Must inherit from AbstractBaseShader.
      */
-    setShaderClass(shaderClass: typeof AbstractBaseShader): void;
+    setShaderClass(shaderClass: AbstractBaseShader.AnyConstructor): void;
 
-    protected override _render(_renderer: PIXI.Renderer): void;
+    protected override _render(renderer: PIXI.Renderer): void;
 
     protected override _calculateBounds(): void;
 
@@ -38,6 +39,15 @@ declare global {
      */
     containsPoint(point: PIXI.IPointData): boolean;
 
-    override destroy(options?: boolean | PIXI.IDestroyOptions): void;
+    override destroy(options?: PIXI.IDestroyOptions | boolean): void;
   }
+
+  namespace QuadMesh {
+    interface Any extends AnyQuadMesh {}
+    type AnyConstructor = typeof AnyQuadMesh;
+  }
+}
+
+declare abstract class AnyQuadMesh extends QuadMesh {
+  constructor(arg0: never, ...args: never[]);
 }
diff --git a/src/foundry/client/pixi/core/containers/quadtree.d.mts b/src/foundry/client/pixi/core/containers/quadtree.d.mts
index e2c60c902..935450c10 100644
--- a/src/foundry/client/pixi/core/containers/quadtree.d.mts
+++ b/src/foundry/client/pixi/core/containers/quadtree.d.mts
@@ -1,9 +1,13 @@
-export {};
+import type { Brand, InexactPartial, NullishProps } from "../../../../../utils/index.d.mts";
+
+/** @internal */
+interface _QuadtreeObjectBase<T> {
+  r: Canvas.Rectangle;
+  t: T;
+}
 
 declare global {
-  interface QuadtreeObject<T> {
-    r: Canvas.Rectangle;
-    t: T;
+  interface QuadtreeObject<T> extends _QuadtreeObjectBase<T> {
     n: Set<Quadtree<T>>;
   }
 
@@ -14,8 +18,10 @@ declare global {
     /**
      * @param bounds  - The outer bounds of the region
      * @param options - Additional options which configure the Quadtree
+     * @remarks `bounds` is NullishProps because `PIXI.Rectangle`'s constructor casts `null`/`undefined` to `0`.
+     * A `width` or `height` of zero is likely undesirable, however.
      */
-    constructor(bounds: PIXI.Rectangle, options?: Quadtree.Options<T>);
+    constructor(bounds: NullishProps<Canvas.Rectangle>, options?: Quadtree.Options<T>);
 
     /**
      * The bounding rectangle of the region
@@ -60,12 +66,7 @@ declare global {
     /**
      * A constant that enumerates the index order of the quadtree nodes from top-left to bottom-right.
      */
-    static readonly INDICES: {
-      tl: 0;
-      tr: 1;
-      bl: 2;
-      br: 3;
-    };
+    static INDICES: Quadtree.Indices;
 
     /**
      * Return an array of all the objects in the Quadtree (recursive)
@@ -89,7 +90,7 @@ declare global {
      * @param obj - The object being inserted
      * @returns The Quadtree nodes the object was added to.
      */
-    insert(obj: QuadtreeObject<T>): Quadtree<T>[];
+    insert(obj: Quadtree.QuadtreeObject<T>): Quadtree<T>[];
 
     /**
      * Remove an object from the quadtree
@@ -103,7 +104,7 @@ declare global {
      * @param obj - The object being inserted
      * @returns The Quadtree nodes the object was added to
      */
-    update(obj: QuadtreeObject<T>): Quadtree<T>[];
+    update(obj: Quadtree.QuadtreeObject<T>): Quadtree<T>[];
 
     /**
      * Get all the objects which could collide with the provided rectangle
@@ -111,21 +112,7 @@ declare global {
      * @param options - Options affecting the collision test.
      * @returns The objects in the Quadtree which represent potential collisions
      */
-    getObjects(
-      rect: Canvas.Rectangle,
-      options?: {
-        /* Function to further refine objects to return
-         * after a potential collision is found. Parameters are the object and rect, and the
-         * function should return true if the object should be added to the result set.
-         */
-        collisionTest: (o: QuadtreeObject<T>, rect: Canvas.Rectangle) => boolean;
-
-        /** The existing result set, for internal use.
-         *  (default: `new Set<T>()`)
-         */
-        _s?: Set<T>;
-      },
-    ): Set<T>;
+    getObjects(rect: Canvas.Rectangle, options?: Quadtree.GetObjectsOptions<T>): Set<T>;
 
     /**
      * Obtain the leaf nodes to which a target rectangle belongs.
@@ -150,50 +137,120 @@ declare global {
 
     /**
      * Visualize the nodes and objects in the quadtree
-     * @param objects - Visualize the rectangular bounds of objects in the Quadtree. Default is false.
-     *                  (default: `false`)
      */
-    visualize({ objects }?: { objects?: boolean }): void;
+    visualize({ objects }?: Quadtree.VisualizeOptions): void;
   }
 
-  /**
-   * A subclass of Quadtree specifically intended for classifying the location of objects on the game canvas.
-   */
-  class CanvasQuadtree extends Quadtree<object> {
-    constructor(options?: Quadtree.Options<object>);
+  namespace Quadtree {
+    interface Any extends AnyQuadtree {}
+    type AnyConstructor = typeof AnyQuadtree;
 
-    readonly bounds: PIXI.Rectangle;
-  }
+    /** @internal */
+    type _OptionalSet<T> = NullishProps<{
+      /** @remarks Foundry never passes an object including `n`, which is handled by `obj.n = obj.n || new Set()` in `#insert()` */
+      n?: Set<Quadtree<T>>;
+    }>;
 
-  namespace Quadtree {
-    /**
-     * Additional options which configure the Quadtree
-     */
-    interface Options<T> {
+    interface QuadtreeObject<T> extends _QuadtreeObjectBase<T>, _OptionalSet<T> {}
+
+    type INDICES = Brand<number, "Quadtree.INDICIES">;
+
+    interface Indices {
+      tl: 0 & Quadtree.INDICES;
+      tr: 1 & Quadtree.INDICES;
+      bl: 2 & Quadtree.INDICES;
+      br: 3 & Quadtree.INDICES;
+    }
+
+    /** @internal */
+    type _Options<T> = InexactPartial<{
       /**
        * The maximum number of objects per node
        * @defaultValue `20`
+       * @remarks Can't be `null` because it only has a parameter default.
        */
-      maxObjects?: number;
+      maxObjects: number;
 
       /**
        * The maximum number of levels within the root Quadtree
        * @defaultValue `4`
+       * @remarks Can't be `null` because it only has a parameter default.
        */
-      maxDepth?: number;
+      maxDepth: number;
 
       /**
        * The depth level of the sub-tree. For internal use
        * @defaultValue `0`
-       * @internal
+       * @remarks Can't be `null` because of an `=== 0` check in `#visualize()`, and it only has a parameter default
+       * Foundry marked `@internal`
        */
-      _depth?: number;
+      _depth: number;
 
       /**
        * The root of the quadtree. For internal use
-       * @internal
+       * Foundry marked `@internal`
        */
-      _root?: Quadtree<T>;
-    }
+      _root: Quadtree<T> | null;
+    }>;
+
+    /**
+     * Additional options which configure the Quadtree
+     */
+    interface Options<T> extends _Options<T> {}
+
+    /** @internal */
+    type _GetObjectsOptions<T> = NullishProps<{
+      /**
+       * Function to further refine objects to return
+       * after a potential collision is found. Parameters are the object and rect, and the
+       * function should return true if the object should be added to the result set.
+       */
+      collisionTest: (o: globalThis.QuadtreeObject<T>, rect: Canvas.Rectangle) => boolean;
+
+      /**
+       * The existing result set, for internal use.
+       * @defaultValue `new Set<T>()`
+       * @remarks Foundry marked `@internal`
+       */
+      _s: Set<T>;
+    }>;
+
+    interface GetObjectsOptions<T> extends _GetObjectsOptions<T> {}
+
+    /** @internal */
+    type _VisualizeOptions = NullishProps<{
+      /**
+       * Visualize the rectangular bounds of objects in the Quadtree.
+       * @defaultValue `false`
+       */
+      objects: boolean;
+    }>;
+
+    interface VisualizeOptions extends _VisualizeOptions {}
   }
+  /**
+   * A subclass of Quadtree specifically intended for classifying the location of objects on the game canvas.
+   * @remarks Foundry never uses `Quadtree` directly, only this class, and only ever fills it with `PrimaryCanvasObject`s or `PlaceableObject`s
+   */
+  class CanvasQuadtree<T extends CanvasQuadtree.CanvasQuadtreeObject> extends Quadtree<T> {
+    constructor(options?: Quadtree.Options<T>);
+
+    /** @remarks A getter for `canvas.dimensions.rect` */
+    readonly bounds: PIXI.Rectangle;
+  }
+
+  namespace CanvasQuadtree {
+    interface Any extends AnyCanvasQuadtree {}
+    type AnyConstructor = typeof AnyCanvasQuadtree;
+
+    type CanvasQuadtreeObject = PrimaryCanvasObjectMixin.Any | PlaceableObject.Any;
+  }
+}
+
+declare abstract class AnyQuadtree extends Quadtree<unknown> {
+  constructor(arg0: never, ...args: never[]);
+}
+
+declare abstract class AnyCanvasQuadtree extends CanvasQuadtree<CanvasQuadtree.CanvasQuadtreeObject> {
+  constructor(arg0: never, ...args: never[]);
 }
diff --git a/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts b/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts
index 95fb9091a..bf9476bf2 100644
--- a/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts
+++ b/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts
@@ -11,22 +11,15 @@ declare global {
      * @param shaderCls - Shader class used by this sprite mesh.
      *                    (default: `BaseSamplerShader`)
      */
-    constructor(texture?: PIXI.Texture, shaderCls?: typeof BaseSamplerShader);
+    constructor(texture?: PIXI.Texture | null, shaderClass?: BaseSamplerShader.AnyConstructor);
 
+    /** @defaultValue `true` */
     override isSprite: boolean;
 
     /**
      * Snapshot of some parameters of this display object to render in batched mode.
      */
-    protected _batchData: {
-      _tintRGB: number;
-      _texture: PIXI.Texture;
-      indices: number[];
-      uvs: number[];
-      blendMode: PIXI.BLEND_MODES;
-      vertexData: number[];
-      worldAlpha: number;
-    };
+    protected _batchData: SpriteMesh.BatchData;
 
     /**
      * The indices of the geometry.
@@ -48,7 +41,7 @@ declare global {
     /**
      * The texture that the sprite is using.
      */
-    protected _texture: PIXI.Texture;
+    protected _texture: PIXI.Texture | null;
 
     /**
      * The texture ID
@@ -58,14 +51,15 @@ declare global {
 
     /**
      * Cached tint value so we can tell when the tint is changed.
+     * @defaultValue `[1, 1, 1, 1]`
      */
-    protected _cachedTint: [red: number, green: number, blue: number, alpha: number];
+    protected _cachedTint: Color.RGBAColorVector;
 
     /**
      * The texture trimmed ID.
      * @defaultValue `-1`
      */
-    _textureTrimmedID: number;
+    protected _textureTrimmedID: number;
 
     /**
      * This is used to store the uvs data of the sprite, assigned at the same time
@@ -102,6 +96,7 @@ declare global {
 
     /**
      * The transform ID.
+     * @defaultValue `-1`
      */
     private _transformID: number;
 
@@ -165,6 +160,7 @@ declare global {
      */
     get padding(): number;
 
+    /** @throws If `value < 0` */
     set padding(value);
 
     /**
@@ -208,6 +204,7 @@ declare global {
     /**
      * Returns the SpriteMesh associated batch plugin. By default the returned plugin is that of the associated shader.
      * If a plugin is forced, it will returns the forced plugin.
+     * @defaultValue `this._shader.pluginName`
      */
     get pluginName(): string;
 
@@ -220,7 +217,7 @@ declare global {
     /**
      * The texture that the sprite is using
      */
-    get texture(): PIXI.Texture;
+    get texture(): PIXI.Texture | null;
 
     set texture(texture);
 
@@ -235,8 +232,9 @@ declare global {
      * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.
      *
      * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
+     * @privateRemarks Technically should be `ObservablePoint<this>` but this breaks `PrimarySpriteMesh`
      */
-    get anchor(): PIXI.ObservablePoint;
+    get anchor(): PIXI.ObservablePoint<SpriteMesh.Any>;
 
     set anchor(anchor);
 
@@ -246,12 +244,13 @@ declare global {
      * A value of 0xFFFFFF will remove any tint effect.
      * @defaultValue `0xFFFFFF`
      */
-    get tint(): PIXI.ColorSource;
+    get tint(): number;
 
     set tint(tint);
 
     /**
      * The HTML source element for this SpriteMesh texture.
+     * @privateRemarks This could possibly be `PIXI.ImageSource | null`, but the below is Foundry's typing, which I think is accurate in practice
      */
     get sourceElement(): HTMLImageElement | HTMLVideoElement | null;
 
@@ -263,12 +262,12 @@ declare global {
     /**
      * When the texture is updated, this event will fire to update the scale and frame.
      */
-    _onTextureUpdate(): void;
+    protected _onTextureUpdate(): void;
 
     /**
      * Called when the anchor position updates.
      */
-    _onAnchorUpdate(): void;
+    protected _onAnchorUpdate(): void;
 
     /**
      * Update uvs and push vertices and uv buffers on GPU if necessary.
@@ -277,9 +276,9 @@ declare global {
 
     /**
      * Initialize shader based on the shader class type.
-     * @param shaderClass - Shader class used. Must inherit from AbstractBaseShader.
+     * @param shaderClass - The shader class
      */
-    setShaderClass(shaderClass: typeof AbstractBaseShader): void;
+    setShaderClass(shaderClass: BaseSamplerShader.AnyConstructor): void;
 
     override updateTransform(): void;
 
@@ -306,9 +305,10 @@ declare global {
 
     override getLocalBounds(rect: PIXI.Rectangle): PIXI.Rectangle;
 
+    /** @privateRemarks Foundry still marks this `@override` from when this class used to extend `PIXI.Mesh` */
     containsPoint(point: PIXI.IPointData): boolean;
 
-    override destroy(options: PIXI.IDestroyOptions | boolean): void;
+    override destroy(options?: PIXI.IDestroyOptions | boolean): void;
 
     /**
      * Create a SpriteMesh from another source.
@@ -318,9 +318,52 @@ declare global {
      * @param shaderClass    - The shader class to use. BaseSamplerShader by default.
      */
     static from(
-      source: string | PIXI.Texture | HTMLCanvasElement | HTMLVideoElement,
+      source: PIXI.Texture | HTMLImageElement | HTMLVideoElement | string,
       textureOptions?: PIXI.IBaseTextureOptions,
-      shaderClass?: typeof AbstractBaseShader,
+      shaderClass?: BaseSamplerShader.AnyConstructor,
     ): SpriteMesh;
   }
+
+  namespace SpriteMesh {
+    interface Any extends AnySpriteMesh {}
+    type AnyConstructor = typeof AnySpriteMesh;
+
+    /** Snapshot of some parameters of this display object to render in batched mode. */
+    interface BatchData {
+      _tintRGB: number | undefined;
+      _texture: PIXI.Texture | undefined | null;
+
+      /**
+       * @defaultValue `this.#geometry.indexBuffer.data`
+       * @remarks Set during construction
+       */
+      indices: number[];
+
+      /**
+       * @defaultValue `this.#geometry.buffers[1].data`
+       * @remarks Set during construction
+       */
+      uvs: number[];
+
+      blendMode: PIXI.BLEND_MODES | undefined;
+
+      /**
+       * @defaultValue `this.#geometry.buffers[0].data`
+       * @remarks Set during construction
+       */
+      vertexData: number[];
+
+      worldAlpha: number | undefined;
+
+      /**
+       * @defaultValue `this`
+       * @remarks Set during construction
+       */
+      object: SpriteMesh;
+    }
+  }
+}
+
+declare abstract class AnySpriteMesh extends SpriteMesh {
+  constructor(arg0: never, ...args: never[]);
 }
diff --git a/src/foundry/client/pixi/core/containers/unbound-container.d.mts b/src/foundry/client/pixi/core/containers/unbound-container.d.mts
index ea4c330b3..b79e39289 100644
--- a/src/foundry/client/pixi/core/containers/unbound-container.d.mts
+++ b/src/foundry/client/pixi/core/containers/unbound-container.d.mts
@@ -1,4 +1,4 @@
-import type { Transform } from "pixi.js";
+export {};
 
 declare global {
   /**
@@ -9,6 +9,11 @@ declare global {
     transform: UnboundTransform;
   }
 
+  namespace UnboundContainer {
+    interface Any extends AnyUnboundContainer {}
+    type AnyConstructor = typeof AnyUnboundContainer;
+  }
+
   /**
    * A custom Transform class which is not bound to the parent worldTransform.
    * localTransform are working as usual.
@@ -16,6 +21,19 @@ declare global {
   class UnboundTransform extends PIXI.Transform {
     static override IDENTITY: UnboundTransform;
 
-    override updateTransform(parentTransform: Transform): void;
+    override updateTransform(parentTransform: PIXI.Transform): void;
+  }
+
+  namespace UnboundTransform {
+    interface Any extends AnyUnboundTransform {}
+    type AnyConstructor = typeof AnyUnboundTransform;
   }
 }
+
+declare abstract class AnyUnboundContainer extends UnboundContainer {
+  constructor(arg0: never, ...args: never[]);
+}
+
+declare abstract class AnyUnboundTransform extends UnboundTransform {
+  constructor(arg0: never, ...args: never[]);
+}
diff --git a/src/foundry/client/pixi/groups/primary.d.mts b/src/foundry/client/pixi/groups/primary.d.mts
index 5de7aeb3a..9aefe7e4f 100644
--- a/src/foundry/client/pixi/groups/primary.d.mts
+++ b/src/foundry/client/pixi/groups/primary.d.mts
@@ -76,7 +76,7 @@ declare global {
     /**
      * A Quadtree which partitions and organizes primary canvas objects.
      */
-    quadtree: CanvasQuadtree;
+    quadtree: CanvasQuadtree<PrimaryCanvasObjectMixin.Any>;
 
     /**
      * The collection of PrimaryDrawingContainer objects which are rendered in the Scene.
diff --git a/src/foundry/client/pixi/layers/base/placeables-layer.d.mts b/src/foundry/client/pixi/layers/base/placeables-layer.d.mts
index 5843e7952..186ca7048 100644
--- a/src/foundry/client/pixi/layers/base/placeables-layer.d.mts
+++ b/src/foundry/client/pixi/layers/base/placeables-layer.d.mts
@@ -57,7 +57,7 @@ declare global {
     /**
      * A Quadtree which partitions and organizes Walls into quadrants for efficient target identification.
      */
-    quadtree: Quadtree<
+    quadtree: CanvasQuadtree<
       ConcretePlaceableOrPlaceableObject<Document.ConfiguredObjectInstanceForName<DocumentName>>
     > | null;
 
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 754e287d3..e188b96e7 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
@@ -168,14 +168,18 @@ declare global {
    * @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.Container.AnyConstructor>(
+  function PrimaryCanvasObjectMixin<BaseClass extends PrimaryCanvasObjectMixin.BaseClass>(
     DisplayObject: BaseClass,
   ): Mixin<typeof PrimaryCanvasObject, ReturnType<typeof CanvasTransformMixin<BaseClass>>>;
 
   namespace PrimaryCanvasObjectMixin {
-    type AnyMixed = ReturnType<typeof PrimaryCanvasObjectMixin<PIXI.Container.AnyConstructor>>;
+    interface Any extends AnyPrimaryCanvasObject {}
+    type AnyConstructor = typeof AnyPrimaryCanvasObject;
 
-    type MixinClass = typeof PrimaryCanvasObject;
+    type AnyMixedConstructor = ReturnType<typeof PrimaryCanvasObjectMixin<PrimaryCanvasObjectMixin.BaseClass>>;
+    interface AnyMixed extends AnyMixedConstructor {}
+
+    type BaseClass = PIXI.Container.AnyConstructor;
   }
 
   /**
@@ -184,13 +188,24 @@ declare global {
    * @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.Container.AnyConstructor>(
+  function CanvasTransformMixin<BaseClass extends CanvasTransformMixin.BaseClass>(
     DisplayObject: BaseClass,
   ): Mixin<typeof CanvasTransformMixinClass, BaseClass>;
 
   namespace CanvasTransformMixin {
-    type AnyMixed = ReturnType<typeof CanvasTransformMixin<PIXI.Container.AnyConstructor>>;
+    interface Any extends AnyCanvasTransformMixinClass {}
+    type AnyConstructor = typeof AnyCanvasTransformMixinClass;
+
+    type AnyMixedConstructor = ReturnType<typeof CanvasTransformMixin<CanvasTransformMixin.BaseClass>>;
+    interface AnyMixed extends AnyMixedConstructor {}
 
-    type MixinClass = typeof CanvasTransformMixinClass;
+    type BaseClass = PIXI.Container.AnyConstructor;
   }
 }
+
+declare abstract class AnyPrimaryCanvasObject extends PrimaryCanvasObject {
+  constructor(arg0: never, ...args: never[]);
+}
+declare abstract class AnyCanvasTransformMixinClass extends CanvasTransformMixinClass {
+  constructor(arg0: never, ...args: never[]);
+}
diff --git a/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts b/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts
index 2f1f7efcd..3a25816a0 100644
--- a/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts
+++ b/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts
@@ -91,7 +91,7 @@ declare global {
       | Coordinates
       | Coordinates[]
       | Color.RGBColorVector
-      | Color.RGVAColorVector
+      | Color.RGBAColorVector
       | PIXI.Texture
       | PIXI.Matrix;
 
diff --git a/src/foundry/common/utils/color.d.mts b/src/foundry/common/utils/color.d.mts
index c7e91857f..64053a0dd 100644
--- a/src/foundry/common/utils/color.d.mts
+++ b/src/foundry/common/utils/color.d.mts
@@ -292,7 +292,7 @@ declare class Color extends Number {
 
 declare namespace Color {
   type RGBColorVector = [r: number, g: number, b: number];
-  type RGVAColorVector = [r: number, g: number, b: number, a: number];
+  type RGBAColorVector = [r: number, g: number, b: number, a: number];
   type HSVColorVector = [h: number, s: number, v: number];
   type HSLColorVector = [h: number, s: number, l: number];
 


Test patch:
diff --git a/tests/foundry/client/pixi/core/containers/cached-container.test-d.ts b/tests/foundry/client/pixi/core/containers/cached-container.test-d.ts
index 154b2d6cf..9690d8823 100644
--- a/tests/foundry/client/pixi/core/containers/cached-container.test-d.ts
+++ b/tests/foundry/client/pixi/core/containers/cached-container.test-d.ts
@@ -16,3 +16,4 @@ expectTypeOf(
   }),
 ).toEqualTypeOf<void>();
 expectTypeOf(container.render(new PIXI.Renderer())).toEqualTypeOf<void>();
+expectTypeOf(container.alphaMode).toEqualTypeOf<undefined>();
diff --git a/tests/foundry/client/pixi/core/containers/point-source-mesh.test-d.ts b/tests/foundry/client/pixi/core/containers/point-source-mesh.test-d.ts
index 9435a3e7e..631423583 100644
--- a/tests/foundry/client/pixi/core/containers/point-source-mesh.test-d.ts
+++ b/tests/foundry/client/pixi/core/containers/point-source-mesh.test-d.ts
@@ -1,10 +1,15 @@
 import { expectTypeOf } from "vitest";
 
 const myGeometry = new PIXI.Geometry();
-
-const myShader = AdaptiveLightingShader.create();
-
-// Matches a call made in RenderedPointSource##createMesh
-const myPointSourceMesh = new PointSourceMesh(myGeometry, myShader);
-
-expectTypeOf(myPointSourceMesh.addChild()).toEqualTypeOf<never>();
+const myShader = AdaptiveBackgroundShader.create();
+declare const someState: PIXI.State;
+declare const someRenderer: PIXI.Renderer;
+declare const someRect: PIXI.Rectangle;
+
+// Matches a call made in `RenderedPointSource##createMesh`, the only place Foundry calls `new`
+const myPSM = new PointSourceMesh(myGeometry, myShader, someState);
+
+expectTypeOf(myPSM.shader).toEqualTypeOf<typeof myShader>();
+expectTypeOf(myPSM.addChild()).toEqualTypeOf<never>();
+expectTypeOf(myPSM["_render"](someRenderer)).toEqualTypeOf<void>();
+expectTypeOf(myPSM.getLocalBounds(someRect)).toEqualTypeOf<PIXI.Rectangle>();
diff --git a/tests/foundry/client/pixi/core/containers/quad-mesh.test-d.ts b/tests/foundry/client/pixi/core/containers/quad-mesh.test-d.ts
index dbd895b57..351d9bdb1 100644
--- a/tests/foundry/client/pixi/core/containers/quad-mesh.test-d.ts
+++ b/tests/foundry/client/pixi/core/containers/quad-mesh.test-d.ts
@@ -3,3 +3,5 @@ import { expectTypeOf } from "vitest";
 const myBaseSamplerShaderQuadMesh = new QuadMesh(BaseSamplerShader);
 
 expectTypeOf(myBaseSamplerShaderQuadMesh.scale.x).toEqualTypeOf<number>();
+expectTypeOf(myBaseSamplerShaderQuadMesh.shader).toEqualTypeOf<AbstractBaseShader>();
+expectTypeOf(myBaseSamplerShaderQuadMesh.containsPoint({ x: 500, y: 500 })).toEqualTypeOf<boolean>();
diff --git a/tests/foundry/client/pixi/core/containers/quadtree.test-d.ts b/tests/foundry/client/pixi/core/containers/quadtree.test-d.ts
index ff10f8fec..6d79fed79 100644
--- a/tests/foundry/client/pixi/core/containers/quadtree.test-d.ts
+++ b/tests/foundry/client/pixi/core/containers/quadtree.test-d.ts
@@ -1,9 +1,30 @@
 import { expectTypeOf } from "vitest";
 
-const myQuadTree = new CanvasQuadtree();
+expectTypeOf(Quadtree.INDICES).toMatchTypeOf<Record<keyof Quadtree.Indices, Quadtree.INDICES>>();
 
-let myTokenDocument: any;
+type TCI = Token.ConfiguredInstance;
+declare const someToken: TCI;
+declare const someRect: PIXI.Rectangle;
+declare const collisionTest: (o: QuadtreeObject<TCI>, rect: Canvas.Rectangle) => boolean;
 
-const myToken = new Token(myTokenDocument);
+const myQuadtree = new Quadtree<TCI>({ x: undefined, y: null, height: 100, width: 100 });
 
-expectTypeOf(myQuadTree.getObjects(myToken.bounds)).toEqualTypeOf<Set<object>>();
+expectTypeOf(myQuadtree.all).toEqualTypeOf<QuadtreeObject<TCI>[]>();
+expectTypeOf(myQuadtree.objects).toEqualTypeOf<QuadtreeObject<TCI>[]>();
+expectTypeOf(myQuadtree.bounds).toEqualTypeOf<PIXI.Rectangle>();
+expectTypeOf(myQuadtree.root).toEqualTypeOf<Quadtree<TCI>>();
+expectTypeOf(myQuadtree.split()).toEqualTypeOf<Quadtree<TCI>>();
+expectTypeOf(myQuadtree.visualize({ objects: true })).toEqualTypeOf<void>();
+
+expectTypeOf(myQuadtree.insert({ r: someToken.bounds, t: someToken })).toEqualTypeOf<Quadtree<TCI>[]>();
+expectTypeOf(myQuadtree.update({ r: someRect, t: someToken })).toEqualTypeOf<Quadtree<TCI>[]>();
+expectTypeOf(myQuadtree.remove(someToken)).toEqualTypeOf<typeof myQuadtree>();
+
+expectTypeOf(myQuadtree.getObjects(someToken.bounds, { collisionTest })).toEqualTypeOf<Set<TCI>>();
+expectTypeOf(myQuadtree.getLeafNodes(someRect)).toEqualTypeOf<Quadtree<TCI>[]>();
+expectTypeOf(myQuadtree.getChildNodes(someRect)).toEqualTypeOf<Quadtree<TCI>[]>();
+expectTypeOf(myQuadtree.getAdjacentNodes()).toEqualTypeOf<Quadtree<TCI>[]>();
+
+const myCanvasQuadtree = new CanvasQuadtree<TCI>();
+
+expectTypeOf(myCanvasQuadtree.bounds).toEqualTypeOf<PIXI.Rectangle>();
diff --git a/tests/foundry/client/pixi/core/containers/sprite-mesh.test-d.ts b/tests/foundry/client/pixi/core/containers/sprite-mesh.test-d.ts
index 60722d20b..c997cd975 100644
--- a/tests/foundry/client/pixi/core/containers/sprite-mesh.test-d.ts
+++ b/tests/foundry/client/pixi/core/containers/sprite-mesh.test-d.ts
@@ -1,5 +1,26 @@
 import { expectTypeOf } from "vitest";
 
 const mySpriteMesh = new SpriteMesh();
+declare const someTex: PIXI.Texture;
+declare const someRect: PIXI.Rectangle;
 
-expectTypeOf(mySpriteMesh.texture.baseTexture.resource).toEqualTypeOf<PIXI.Resource>();
+expectTypeOf(
+  SpriteMesh.from(
+    someTex,
+    {
+      alphaMode: PIXI.ALPHA_MODES.PMA,
+      scaleMode: PIXI.SCALE_MODES.LINEAR,
+    },
+    FogSamplerShader,
+  ),
+).toEqualTypeOf<SpriteMesh>();
+
+if (mySpriteMesh.texture) {
+  expectTypeOf(mySpriteMesh.texture.baseTexture.resource).toEqualTypeOf<PIXI.Resource>();
+} else {
+  expectTypeOf(mySpriteMesh.texture).toEqualTypeOf<null>();
+}
+expectTypeOf(mySpriteMesh.setShaderClass(OccludableSamplerShader)).toEqualTypeOf<void>();
+expectTypeOf(mySpriteMesh.anchor).toEqualTypeOf<PIXI.ObservablePoint<SpriteMesh>>();
+expectTypeOf(mySpriteMesh.containsPoint({ x: 1, y: 2 })).toEqualTypeOf<boolean>();
+expectTypeOf(mySpriteMesh.getLocalBounds(someRect)).toEqualTypeOf<PIXI.Rectangle>();
diff --git a/tests/foundry/client/pixi/layers/base/placeables-layer.test-d.ts b/tests/foundry/client/pixi/layers/base/placeables-layer.test-d.ts
index 937941c6e..1ed00f4e6 100644
--- a/tests/foundry/client/pixi/layers/base/placeables-layer.test-d.ts
+++ b/tests/foundry/client/pixi/layers/base/placeables-layer.test-d.ts
@@ -29,7 +29,7 @@ expectTypeOf(layer.preview).toEqualTypeOf<PIXI.Container | null>();
 expectTypeOf(layer.history).toEqualTypeOf<
   Array<{ type: "create" | "update" | "delete"; data: Array<AmbientLightDocument["_source"]> }>
 >();
-expectTypeOf(layer.quadtree).toEqualTypeOf<Quadtree<AmbientLight> | null>();
+expectTypeOf(layer.quadtree).toMatchTypeOf<CanvasQuadtree<PlaceableObject.Any> | null>();
 expectTypeOf(layer.documentCollection).toEqualTypeOf<EmbeddedCollection<AmbientLightDocument, Scene> | null>();
 expectTypeOf(layer.gridPrecision).toEqualTypeOf<number>();
 expectTypeOf(layer.hud).toEqualTypeOf<BasePlaceableHUD<AmbientLight> | null>();