I am looking to find a way to make the following piece of code compile without having to declare an interface.
var a : <A>{ (value: A): void; (): A; } = null;
I am looking to find a way to make the following piece of code compile without having to declare an interface.
var a : <A>{ (value: A): void; (): A; } = null;
It doesn't make sense for a generic type like that to even exist. It's the same reason you can't write Foo<T> x; in C++ without an actual T in scope -- once the type is manifest, it has to be bound.
You can write this instead, which probably has the semantics you wanted anyway.
var a: { <A>(value: A): void; <A>(): A; } = null;
If that's not what you were looking for, it'd be useful to post some examples of what valid and invalid calls on a would look like.
{ <A>(value: A): void; <B>(): B; }