Newest Update has Luau Typings that are Absolutely Terrible and Regressive

Issue Type: Other
Impact: Critical
Frequency: Constantly
Date First Experienced: 2021-04-15 00:04:00 (-06:00)
Date Last Experienced: 2021-04-15 00:04:00 (-06:00)

Reproduction Steps:
Just opened studio to find 200+ warnings in my codebase, all related to sudden changes in the typing of instances. (I’ve been slowly chipping my code asserting some types as any to compensate, which is probably a bad idea long term)

These typings are, in many cases, regressive, and in other cases, just terrible to work with.
For example, the PlayerAdded event’s type has changed from (Player) -> () to (Instance) ->(), making it so that I have to assert my function argument to the any type, or deal with the player object as though it were just any arbitrary instance.

GetGlobalDataStore no longer takes in a scope argument according to these typings

TweenService:Create() returns an Instance instead of a Tween
image

And the thing I’m worried about the most is that game.Players.LocalPlayer and workspace.CurrentCamera are now typed as optional properties. Even though I know these can be optional depending on whether you’re on the server or client, we simply do not have enough tools in Luau to deal with optional types, and this can lead to some super ugly long-term code written to overcome short-term limitations.

For example, game.Players.LocalPlayer.Name now has to be written as (game.Players.LocalPlayer :: Player).Name

Luau currently does not have the tools to deal with optional typings, and I have a strong disagreement with some of these optional typings philosophically. It makes it harder to write code in the long run, and currently there is no good syntax to remove the “nilable” part on an expression’s type. In addition to this, the only way to do so right now is by using an if truthyIdentifier then statement, which not only makes your code look cumulatively bad when you have a million indentations and conditionals, but you also can’t actually strip the nilability off of boolean values, because booleans can be… well… falsy.

Expected Behavior:
I wouldn’t expect most of these warnings to appear, and I really don’t want to have to work around them in the short term because it makes my code unhealthier and less strict in the long term. I would consider that enough to mark this as “critical” because it will cause irreversible damage to my codebase if I try to work around it.

Actual Behavior:
I have 200 warnings that aren’t my fault.

Workaround:
Using Clonetrooper1019’s studio modder to flip the most recent flag maybe?

4 Likes

Hello!

Sorry about that! We’ve reverted the offending change for the moment.

Things should go back to normal the next time you restart Studio.

6 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.