I have a very complex project involving hundreds/thousands of different types floating around. It is common where I need a defined type to be able to reference itself. Example given:
export type common_schema<T> = {
Get: (self: common_schema<T>) -> T,
Set: (self: common_schema<T>, newValue: T) -> nil,
}
export type checked_schema<T> = common_schema<T> & {
Unchecked: (self: checked_schema<T>) -> unchecked_schema<T>,
}
export type unchecked_schema<T> = common_schema<T?> & {
Checked: (self: unchecked_schema<T>) -> checked_schema<T>,
}
This is used for an AI framework for the blackboard, where types can be “checked” or “unchecked”. I have multiple scenarios where this occurs in my project, and is primarily used to define Objects which require a self reference (basic object oriented design).
Normally, this type definition behaves perfectly normal and intellisense works fine.
The issue occurs when I have a namespace in a project that requires many different types like this. All of the sudden, out of nowhere, intellisense will just break. I can solve this by commenting ANY self referencing type definitions, even if it’s completely unrelated to the code in question. It seems like there is some kind of artificial limitation on the resolver for a certain depth where it will just give up and fail. Almost like a “stack overflow” situation…
Expected behavior
I expect to be able to have any number of cyclical referencing types, which more/less mean - Object Oriented typed. Object oriented types always have the first argument “self” as the reference to itself. This is essential.
Additionally, if there is such an error being caused it is not displayed to me (the user of studio) as to what the error is. The error is completely silent. No red underlines, nothing. This is bad UX.
A private message is associated with this bug report