-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the types
library pollutes the globals
#1564
Comments
There is no Marking as 'invalid'. Please provide more information about your issue before we close it. |
Maybe I have an old version, but this seems like valid formed code to me type function _Pair(first, second)
local thing = first:components()[2]
if thing:readproperty(types.singleton("__T")):is("nil") then
return second
else
return first
end
end
export type Pair<T, U> = _Pair<T, U>
type Test = Pair<Entity<nil>, Entity<Vector3>> -- Entity<Vector3> as expected
export type Entity<T = nil> = number & { __T: T } I tested it against my cases and it worked |
Yes, that code is valid. |
I am getting "shadowing variables" errors on variables outside of type functions that are named "types" I can provide you the whole file if that helps, it is pretty large though! |
It would have been helpful to include that error message in your original issue description. |
I expect
types
to only be referenced and recognized as a global in type functions, however currently it shadows seemingly gets referenced anywhere; if this is an unrealistic expectation, I could change my code but I do have a lot of code that names variablestypes
so it would be a shame.The text was updated successfully, but these errors were encountered: