Type stub bugs
Hey team amazing!
First let me just express how thankful I am for your tireless work and exciting stuff you bring with Rive. You rock!
Playing around with scripting and various environments I bumped int to these bugs. May be more cosmetic than crucial, however I just wanted to post them.
Rive Luau type-stub bugs — 4 false positives flagged by the type-checker on code that matches the official API docs
The bundled Luau type stubs for the Rive SDK are out of sync with the documented API at https://rive.app/docs/scripting/api-reference. The runtime accepts the documented forms, but the type-checker flags them. Each item below cites the exact warning, the documented signature, and a minimal repro.
1. Mat2D missing __mul declaration
Warning: TypeError: Binary operator '*' not supported by types 'Mat2D' and 'Mat2D' (Luau1018)
Docs: https://rive.app/docs/scripting/api-reference/mat2d/mat2d — documents Mat2D * Mat2D → Mat2D and Mat2D * Vector → Vector as the primary composition operator, with no alternative method. Example from the docs: translation * scale.
Repro:
local t = Mat2D.withTranslation(0, 0) * Mat2D.withScale(1, 1)
Fix needed: Declare __mul overloads on Mat2D for both Mat2D × Mat2D → Mat2D and Mat2D × Vector → Vector.
2. Artboard declared non-generic instead of Artboard<T>
Warning: TypeError: Generic type 'Artboard' expects 0 type arguments, but 1 is specified
Docs: https://rive.app/docs/scripting/api-reference/artboards/artboard — Artboard<T> where T is the bound ViewModel type. The docs' own examples use Artboard<Data.Character> and Artboard<nil> (for no bound ViewModel).
Repro:
type MyNode = {
source: Input<Artboard<nil>>,
}Fix needed: Declare Artboard as a generic type with one parameter (the bound ViewModel type, defaulting to nil).
3. Vector.lengthSquared missing from stubs
Warning: TypeError: Key 'lengthSquared' not found in table '{ cross: (Vector, Vector) -> number, distance: (Vector, Vector) -> number, ... 5 more ... }'
Docs: https://rive.app/docs/scripting/api-reference/vector/vector — Vector.lengthSquared(v: Vector) → number is documented as a static function ("Returns the squared length of the given vector"). The instance form v:lengthSquared() is documented as deprecated in favor of the static.
Repro:
local sq = Vector.lengthSquared(Vector.xy(3, 4))
Fix needed: Add lengthSquared to the Vector static table. Worth auditing the same table for length, dot, cross, distance, normalized.
4. Color.alpha / .red / .green / .blue missing 2-arg setter overload
Warning: TypeError: Argument count mismatch. Function 'Color.alpha' expects 1 argument, but 2 are specified
Docs: https://rive.app/docs/scripting/api-reference/color/color — all four channel accessors are documented as channel(color: Color, value: number?) → number | Color. The 1-arg form returns the channel value; the 2-arg form returns a new Color with that channel replaced.
Repro:
local faded = Color.alpha(Color.rgb(255, 0, 0), 128) -- documented 2-arg setter form
Fix needed: The stubs apparently only declare the 1-arg getter overload. Add the 2-arg setter overload to Color.alpha, .red, .green, .blue.
Environment
Surfaced in the Rive editor's Luau type-checker (Luau1018 and similar) on node scripts.
All four warnings appear on code that matches the documented API verbatim — confirmed against https://rive.app/docs/scripting/api-reference on 2026-05-10.
Workaround in all cases: ignore the warning, since the runtime accepts the documented form. Prefer not to suppress with :: any casts since that would discard correct typing elsewhere.