Search code examples
typescripttypeorm

Typeorm Error ColumnTypeUndefinedError: Column type for #name is not defined and cannot be guessed


var decorated = decorator(target, propertyKey, descriptor); ^ ColumnTypeUndefinedError: Column type for Author#name is not defined and cannot be guessed. Make sure you have turned on an "emitDecoratorMetadata": true option in tsconfig.json. Also make sure you have imported "reflect-metadata" on top of the main entry file in your application (before any entity imported).If you are using JavaScript instead of TypeScript you must explicitly provide a column type.


Solution

  • Go into your tsconfig file and uncomment "emitDecoratorMetadata": true, then install reflect-metadata and go into your application entry file, for example, app.ts or index.ts or server.ts depending on how you called it, and import reflect-metadata follow the steps below

    npm install reflect-metadata
    
    import "reflect-metadata";