Unable to get type arguments of class
See original GitHub issueIt looks like reading the type arguments of a class doesn’t work. Inner Type of type aliases resolve correctly, but not classes.
type Foo<Type> = Type & {}
class Bar<Type> {}
@inject()
export class Baz {
foo: Foo<string> // type.innerTypes contains string
bar: Bar<string> // type.innerTypes is empty. type.getTypeParameters() returns Type. type.getTypeArguments() is empty
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How do I get a class instance of generic type T? - Stack Overflow
A popular solution to this is to pass the Class of the type parameter into the constructor of the generic type, e.g. class...
Read more >Restrictions on Generics (The Java™ Tutorials > Learning the ...
A class's static field is a class-level variable shared by all non-static objects of the class. Hence, static fields of type parameters are...
Read more >Constraints on type parameters - C# Programming Guide
Learn about constraints on type parameters. Constraints tell the compiler what capabilities a type argument must have.
Read more >Java Generics Example Tutorial - Generic Method, Class ...
We use angle brackets (<>) to specify the type parameter. To understand the benefit, let's say we have a simple class as:
Read more >[Solved] Get generic type name in java - CodeProject
I got an exception that says: " class sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to class java.lang.Class (sun.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
that’s great!
I was considering the following about
tst-reflect
usage,