This repository has been archived by the owner on May 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for array types #22
Comments
I guess instead of an enum for type, we need to do something like: type Type = 'void' | 'bool' | 'int' | 'float' | Array<T extends Type>;
class Array<T extends Type> {
// ...
} Not sure if that even compiles though due to the recursive nature of that definition... |
OR maybe: interface Type {
string source();
}
type BasicType = Void | Bool | Int | Float; // etc
class Array <T extends BasicType> {
// ...
}
type Type = BasicType | Array<T>; |
I'm liking the second way... reading more about TypeScripts type system since I'm fairly new to what it has to offer. |
FWIW, we can only support multidimensional arrays with the first way, though that would be easier to support if we create a CFG for recognizing valid types. |
Ah good point. Maybe a good first step is seeing if typescript types can be recursive like that |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Array types need to support arrays of basic types as well as arrays of arrays.
The text was updated successfully, but these errors were encountered: