New Type Solver [Beta]

that is a really great update but can be there a way that automatically (i donot know how to say it so i will just send an image)

13 Likes

Ive been waiting for these features patiently

Im so excited to try them out!

12 Likes

Hello. In my module, I have a dictionary which I store messages in, and I have another module that uses this module’s dictionary to access specific messages. But after I enabled the new type solver, It now produces a warning that says: “Cannot add indexer to table.” How can I solve this warning?

7 Likes

We’d like to have bounded generics completed before the full release of the new type solver, but I’m unsure of exactly what order things will be implemented in, or how long it will take to get things into shape for the full release. Likewise for write-only properties, they’re planned for the full release, but I don’t know when they’ll be done.

15 Likes

Not blocked-4378! Aggghhh!

blocked-4378

There also seems to be a strict-mode inference problem with closures:

--!strict

local A
A = 1

local Value = A + 2 -- fine, is number

local function B(): number
	return A + 3 -- not fine, is number?
end

Anyways, very excited for how this turns out! It definitely feels more stricter, although I’ll probably have to go over some code to make sure everything works properly.

10 Likes

I have to re-write my module from ground up with the new type system :sob: and it’s not even supporting many things I’m trying to do lol.

7 Likes

This is so ducking amazing, I LOVE ITTTTTTTTTTTTTTTT

6 Likes

image
Horrifying sight, especially in a game that had 0 before.


Jokes aside, I do not understand this type error.


That’s the only place indice is used.

10 Likes

Try running a for loop with a table, now it requires an indexer to loop through it for some reason.
Do we have to use the index in order to do a for loop?

6 Likes

I had problems with indexing from a type of {}, because that correctly represents an empty table now, as opposed to an open one.

I just replaced the annotation to {unknown} or {[unknown]: unknown} and that solves it.

5 Likes
export type classData = {
	constructor: (self: any, ...any) -> ()?,
	destructor: (self: any) -> ()?,
	Public: {[any]: any}?,
	Private: {[any]: any}?,
	Protected: {[any]: any}?,
	Friend: {any}?
}

I have a table type like this, so I can’t exactly cast unknown to it, what should I do in this case?

5 Likes

Tell me about it :sob:

7 Likes

I’m assuming the solver isn’t adding an indexer type-function to record table types, which is why you can’t iterate over your classData directly.

Band-aid solution would be to ascribe before iterating:

for Key, Value in Record :: {[string]: unknown} do
end

Otherwise, why can’t you just index the fields individually?

5 Likes

That’s what I did for now, but this solution is pretty much what I used to do in the old type solver, I thought these problems would get solved in the new one.

6 Likes

Is this intended behaviour or is it a bug with the new type solver?

image

6 Likes

Try using this:
key: index<typeof(PlayerData), keyof<typeof(PlayerData)>>

6 Likes

This is exactly the step forward Luau needs! It feels like it addresses some of the bigger practical barriers to using strict mode + type safety that currently exist. Great work to the whole team involved in designing and implementing these new features :heart:

7 Likes

Here’s a code with the blocked-xxxx… error

Code
--!strict


local con: RBXScriptConnection?
local timeElapsed = 0
con = game:GetService("RunService").PostSimulation:Connect(function(dt: number)
	timeElapsed += dt

	if timeElapsed >= 5 then
		con:Disconnect() -- *blocked*: typecheck error occurs here
		con = nil
	end
end)
5 Likes

i was concerned about this being released too early, while i know this is a beta it just doesn’t feel ready yet however i feel like this’ll be leagues better than old solver once it’s resolved
i will probably adjust to try using the new solver since i was looking forward to keyof and type functions but jesus christ that’s a lot of weird errors

image

image

image

7 Likes

Sounds great, but in my project turning this on just has the effect of disabling all linting/typechecking/intellisense globally. It’s not an issue in the template projects so I know it’s not my app configuration. Any idea why this might happen?

5 Likes