Skip to content

declare LuaThread and LuaUserdata as interfaces - #89

Merged
Perryvw merged 1 commit into
TypeScriptToLua:masterfrom
king8fisher:interface-thread-userdata
Nov 30, 2026
Merged

Perryvw merged 1 commit into
TypeScriptToLua:masterfrom
king8fisher:interface-thread-userdata

Conversation

@king8fisher

Copy link
Copy Markdown
Contributor

Closes #88

This changes LuaThread and LuaUserdata from type aliases to interfaces, in both core/global.d.ts and core/5.0/global.d.ts, so they can be extended with declaration merging.

I added a test to test/global.spec.ts that adds a property to both types. Without the change it fails with "Duplicate identifier".

One thing to be aware of: a type alias of an object literal gets an implicit index signature, and an interface doesn't. So a thread or userdata can no longer be passed where a type with a string index signature is expected, like Record<string, unknown> or { [key: string]: symbol }. Record<string, any> and object still accept them. Since neither one is a table I think that's fine, but code that relied on it would need a cast.

@Perryvw
Perryvw merged commit e54e346 into TypeScriptToLua:master Nov 30, 2026
2 checks passed
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.

Declare LuaThread and LuaUserdata as interfaces so they can be extended

2 participants