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 1 commit into
KYRORBLX:mainfrom
Loner1536:fix/static-typings-dot-calls
Open

fix(typings): static Lori API declared as methods causes colon-call argument shift in roblox-ts#1
Loner1536 wants to merge 1 commit 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
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