Skip to content

TypeORM fails with ColumnTypeUndefinedError when using TSX despite emitDecoratorMetadata enabled #740

@wlcastro

Description

@wlcastro

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/wlcastro/typeorm-tsx-decorator-metadata-issue

Problem & expected behavior

This issue has already been reported in #485 and #216, but both were closed and restricted to collaborators — so I’m opening a new issue to share a reproducible example and a workaround that resolves it.

What happened: When using TypeORM with TSX, I get a ColumnTypeUndefinedError for properties decorated with @Column() — even with emitDecoratorMetadata: true in tsconfig.json and reflect-metadata imported correctly.

What I expected: The code should run normally, as it does with ts-node or tsc.

Error stack trace:

ColumnTypeUndefinedError: Column type for User#name is not defined and cannot be guessed.

Explicitly declaring the column type (e.g. @Column("text")) is a workaround for the issue. I’m sharing this to help others and suggest documenting this limitation in TSX.

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions