imports from tst-reflect
See original GitHub issue@Hookyns having some issues with the import, probably some bug in the transformer that messes up the import?
Assuming I need both getType
and TypeKind
imports, the only way it works for me is
import { getType } from "tst-reflect";
import { TypeKind } from "tst-reflect";
Unifying into a single import (linters will note on that) like import { getType, TypeKind } from "tst-reflect";
fails with
tst_reflect_1 is not defined
ReferenceError: tst_reflect_1 is not defined
Tried also import * as Reflect from "tst-reflect"
and then Reflect.getType<MyInterface>()
- also no luck (in this case getType
fails to reflect and returns an empty Type
).
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
tst-reflect - npm
Start using tst-reflect in your project by running `npm i tst-reflect`. ... import { getType } from "tst-reflect"; interface IFoo {} class ...
Read more >Hookyns/tst-reflect: Advanced TypeScript runtime ... - GitHub
Use function getType<TType>(): Type imported from module tst-reflect . import { getType } from "tst-reflect"; interface ...
Read more >tst-reflect-example - StackBlitz
import { getType, Type, AccessModifier,. Accessor } from 'tst-reflect';. export interface InterfaceName {. property1: string;. property2: string;.
Read more >Can we use reflection to instantiate custom TypeScript model ...
import { getType } from "tst-reflect"; function printTypeProperties<TType>() { const type = getType<TType>(); // <<== get type of generic ...
Read more >typescript-rtti
import { reflect } from 'typescript-rtti'; class A { constructor( readonly someValue : Number, private someOtherValue : string ) { } } class...
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
Ok, I think it’s my fault, though I updated the
package.json
deps to the versions you published last time, mytsconfig.json#compilerOptions#plugins#transform
was pointing to a local outdated clone. Changed totst-reflect-transformer
and have no issues with the imports.Sorry for that. IMHO can close.
Thanks!
Don’t worry, no problem. 😃