When using string literals to define dictionary keys, intellisense works properly by autofilling the keys for you. However, the linter does not seem to pick up any type issues for the values for any of the defined literals:
--!strict
type literals = "foo" | "bar" | "foobar"
local exampleA: {[literals]: string} = {
foo = 1, --> intellisense helps autofill when writing the keys
bar = 2,
foobar = 3,
} --> does not warn
local exampleB: {[string]: string} = {
foo = 1,
bar = 2,
foobar = 3,
} --> warns
Expected behavior
Iād expect keys for string literals to warn when types do not match:
--!strict
type literals = "foo" | "bar" | "foobar"
local exampleA: {[literals]: string} = {
foo = 1,
bar = 2,
foobar = 3,
} --> warns
local exampleB: {[string]: string} = {
foo = 1,
bar = 2,
foobar = 3,
} --> warns