Hey! Suddenly, I’m not receiving LuaU type errors, for example, you can see that in the ModuleTypedef type, the index should be a number, but I put a string, and it’s not giving me an error in the script editor…
How can I fix this?

The autocomplete menu also doesn’t shows:

This bug/problem happens when I use table indexers, example without the table indexer:

Here are some of my settings:
(side note: I have all beta features enabled, however, if I disable them, the bug/problem still occurs)
I’m still having this error… I’m thinking this is a bug, and I would like to gather attention to Roblox bug staff, so they can do something about this… If there’s any thread posted in the forum talking about how to post a #bug-reports without being a Regular
member, please send me it on private messages.
Only thing I would suggest is reinstall studio and see if that fixes it
1 Like
Maybe I’m missing something but ModuleTypedef
looks like it’s keys are number
, but you’re trying to create a key ["d"]
which is a string
?
Does the autocomplete appear if you use [1]
as a key instead?
I’ve tried reinstalling it, and it’s still not working; even with plugins off.
I tested it and it does!

But now, the problem should be that the editor should have underlined it with an error that it should be a number and not a string (before this happened it used to be like that).
When assigning a table to a typed variable, Luau does not care if there are extra keys in that table.
The table is only sealed, after it’s assigned:
--!strict
type MyType = { a: number }
-- this is fine, we can use a wider type in assignment
local x: MyType = { a = 1, b = 2 }
-- ... but we can't actually access that additional property
print(x.b) -- error!
x.b = 3 -- error!
This is an intended feature.
If you really wanted you could explicitly say “all other keys should be nil”, but then you wouldn’t get errors when accessing non-explicitly-defined properties:
--!strict
type MyType = { a: number, [any]: nil }
local x: MyType = { a = 1, b = 2 } -- error! 2 is not nil
print(x.b) -- NOT an error anymore, just always nil
print(x.asdf) -- also NOT an error
x.b = 3 -- error! 3 is not nil
I don’t recommend doing that ^
1 Like
But then… How would I make a dictionary that can accept any string as the key, and follow a specific type definition in their value?
Change the [number]
to [string]
in the ModuleTypedef
I thought you were intentionally using number keys there.
1 Like
Oh, alright. I’ll use it like that, thank you!