Closed avin-kavish closed 2 years ago
Fixed in tst-reflect-transformer@0.9.11
But type
work differently than other generic types. type
is resolved to it's definition. So type Foo<T> = T & {}
is just union T & {}
, cuz Foo
does not rly exist.
Check this StackBlitz out.
thanks for the fix!
While I'm here, isn't it possible to get types from the reference to a class ? i.e. getType(Foo)
instead of getType<Foo>()
@avin-kavish
It is now in tst-reflect@0.7.8
.
It was possible to get type of value getType(new Foo())
; just one line and you are able to get type of class itself getType(Foo)
.
that's great!
I was considering the following about tst-reflect
usage,
/**
* @reflect
*/
function inject<TType extends Constructor>(ctor: TType) {
const typeInfo = getType<TType>()
}
// usage
@inject
class Foo {}
@avin-kavish
@classDecorator
getType<T>()
and types decorated by decorators marked by @reflect
are "reflected".
\
Next
version is prepared for generating metadata about all the modules and types.
\
It's in progress and the latest progress is private until publish of final version.
It looks like reading the type arguments of a class doesn't work. Inner Type of type aliases resolve correctly, but not classes.