mgechev / mgechev/injection-js

`reflect-metadata` not compatible with direct ts run mechanisms

Open
#71 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.4k
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Probably not a bug, but maybe worth a mention somewhere in documents. I could not get the reflect-metadata example or anything similar to work with either `npx tsx foo.ts` or by installing `node-ts`, then running `node-ts foo.ts`. In all cases, I got the dev mode error saying it couldn't resolve a factory for whatever the first recursively injected constructor parameter was, ...to ensure all relevant classes are annotated with `Injectable`.

They were.

A `tsm` compile followed by `node dist/foo.js` was successful.

I guess these jit-compile-and-go hacks are incompatible with the reflection shim?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reflect-metadata example and reproduce the reported behavior using `npx tsx foo.ts` and `node-ts foo.ts`. Compare those results with the successful `tsm` compile followed by `node dist/foo.js`, then document the compatibility status and any relevant limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.