question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hugebducommented, Feb 7, 2022

Can u share some minimal example?

Ok, I think it’s my fault, though I updated the package.json deps to the versions you published last time, my tsconfig.json#compilerOptions#plugins#transform was pointing to a local outdated clone. Changed to tst-reflect-transformer and have no issues with the imports.

Sorry for that. IMHO can close.

Thanks!

0reactions
Hookynscommented, Feb 7, 2022

Don’t worry, no problem. 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found