Skip to content

fix(typings): static Lori API declared as methods causes colon-call argument shift in roblox-ts - #1

Open
Loner1536 wants to merge 2 commits into
KYRORBLX:mainfrom
Loner1536:fix/static-typings-dot-calls
Open

Loner1536 wants to merge 2 commits into
KYRORBLX:mainfrom
Loner1536:fix/static-typings-dot-calls

Conversation

@Loner1536

@Loner1536 Loner1536 commented Jul 6, 2026 •

Copy link
Copy Markdown

Problem

LoriStatic (and Templates.ItemBlacklister.New) use method syntax, so roblox-ts emits colon calls like Lori:mount(nil, options). The top-level Luau module forwards statics through plain dot-call functions (forward() in init.luau), so the Lori table itself gets passed as the first argument and everything shifts by one. Any static call with parameters breaks — e.g. Lori.mount(undefined, options) from TS fails at runtime with:

ui.render:570: invalid argument #3 (Instance expected, got table)

because the module table lands in parent. Lori.create(options) silently passes the module table as options.

Fix (types only — no .luau touched)

  • LoriStatic no longer extends LoriApi; all its members are declared as function properties so roblox-ts emits dot calls, matching the source.
  • Instance methods on LoriApi keep method syntax — clients from Lori.create() wrap their methods via bindDotMethods and accept both conventions, and the raw definitions are colon-style anyway.
  • LoriItemBlacklist: New/FPS/Frame/Memory/Ping are plain closures in the source, so they're now properties too; only addItem is a real method.
  • Added the conventional @rbxts/types triple-slash reference (the typings use Color3, Instance, LuaTuple, etc.).

No compiled-Luau consumer is affected (typings aren't loaded), and existing TS call sites compile unchanged — only the emitted call convention changes, which previously crashed or arg-shifted at runtime, so nothing working can regress.

Tested

In a roblox-ts project consuming this repo as a git dependency: inspected the emitted Luau to confirm dot calls on the static surface and colon calls on instances, and verified in Studio — mount with the Performance template, blacklister, traces, and graphs all working; the render:570 crash is gone.

🤖 Generated with Claude Code

The top-level Lori module forwards static calls to the default client
through plain functions with no self parameter, but the typings declared
them method-style, making roblox-ts emit colon calls that shift every
argument (e.g. Lori.mount() passed the module table as parent and failed
with 'Instance expected, got table' in ui.render).

- LoriStatic no longer extends LoriApi; all members are function
  properties so roblox-ts emits dot calls matching init.luau
- ItemBlacklist: New/FPS/Frame/Memory/Ping are plain closures in the
  source, only addItem is a real method
- add @rbxts/types triple-slash reference

Instance methods on LoriApi keep method syntax; client objects wrap
their methods via bindDotMethods and accept both conventions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dullflowerr dullflowerr self-assigned this Jul 6, 2026
…ntime

Went through the whole Luau source since this PR was already touching the
typings, and found the same kind of drift Konsole had:

- LoriWatch was missing `connected`, which client.luau always sets and only
  the library ever flips - added as readonly.
- WatchOptions was missing `pinned`/`order`, both of which client.luau reads
  straight off options and forwards into the pushed event; the internal
  Luau type (types.luau) already had them, the public .d.ts just fell behind.
- GraphOptions.style was typed as `"bars"` but graph.luau never reads
  options.style at all - it's hardcoded to the bar style every time. Changed
  to `never` so it stops looking configurable.
- Themes.Default is Config.theme, which is `table.freeze`'d in config.luau
  and handed out by reference - now Readonly so mutating it is a type error
  instead of a runtime table.freeze error.
@Loner1536

Copy link
Copy Markdown
Author

While this was open I went back through the whole Luau source and cross-checked it against the typings, same pass I did on the Konsole PR. Found some drift that predates this PR's own fix:

  • LoriWatch was missing connected — client.luau always sets it and only the library ever writes it, so it's now readonly.
  • WatchOptions was missing pinned/order — both are read straight off options in client.luau and forwarded into the pushed event; the internal Luau type already had them, the public typings just hadn't caught up.
  • GraphOptions.style was typed as the literal "bars", but graph.luau never actually reads options.style — it's hardcoded to the bar style regardless of what's passed. Changed to never so it stops looking configurable.
  • Themes.Default is Lori's table.freeze'd config theme, handed out by reference — was typed mutable, so writing to it typechecked but threw at runtime. Now Readonly.

Verified with a small sandbox tsc pass (@rbxts/types/@rbxts/compiler-types, strict) — golden-path watch/graph/Themes.Default usage still compiles, and mutating any of the above is now a compile error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants