You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on Mikro ORM integration with jiti, so we can replace ts-node for transpilation. I decided to add jiti (among other options), because as far as I can tell - it is more compatible with tsc comparing to tsx, and this is very critical, because Mikro ORM relies on legacy decorators and emitDecoratorsMetadata as one of the options to define entities.
However, jiti fails to run code with TS legacy decorators on properties if they're not initialized (even in constructor).
This code is valid for TS and other solutions I've been using so far. But if you import it via jiti, or run with jiti/register, you'll see following error:
node:internal/modules/run_main:104
triggerUncaughtException(
^
[Error: TRANSFORM_ERROR: Definitely assigned fields cannot be initialized here, but only in the constructor
jiti-class-properties-issue/issue.ts:0:0]
Node.js v23.7.0
Environment
Jiti: 2.4.2
Node.js: v23.7.0
Reproduction
https://github.com/octet-stream/jiti-class-properties-issue
Describe the bug
I've been working on Mikro ORM integration with jiti, so we can replace
ts-node
for transpilation. I decided to add jiti (among other options), because as far as I can tell - it is more compatible withtsc
comparing totsx
, and this is very critical, because Mikro ORM relies on legacy decorators and emitDecoratorsMetadata as one of the options to define entities.However, jiti fails to run code with TS legacy decorators on properties if they're not initialized (even in constructor).
Here's how typical Mikro ORM entity looks like:
This code is valid for TS and other solutions I've been using so far. But if you import it via jiti, or run with
jiti/register
, you'll see following error:Related #57
This could be the fix: #361
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: