Interestingly, the Google Closure Compiler supports generic types with syntax like this:
Foo = function() { ... }; Foo.prototype.get = function() { ... }; Foo.prototype.set = function(t) { ... }; var foo = new Foo(); var foo = (new Foo());
Because JSDuck already supports Annotations of the Closure Compiler type, you can now write types like {MyClass.<T>}
. However, JSDuck does not use the @ tag for another purpose, but one implements its own tag as @typevar
or overrides the built-in @template
to fulfill your bids using a custom tag system .
But since there is no support for generic generic types in JSDuck, it will not check your generic types. On the contrary, he will probably complain that you are referring to an unknown type T
and others. But it's easy to get JSDuck to ignore specific types (or type variables) with --external=T
Last remark. The Closure compiler does not support your extends
syntax in type variables, and I really donβt understand why you write T extends Bird
and then {MyArray<T>}
instead of just writing {MyArray<Bird>}
.
source share