Defining a dictionary with string literals as keys causes the corresponding values to go unchecked

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
5 Likes

We recognize this issue and we believe that we have a fix coming in the future. Thank you for pointing this out!

1 Like

Hello, we believe this issue is fixed.