lch*_*bon 5 typescript webpack typeorm
将 TypeORM 添加到 vanilla Javascript 项目但收到此错误。该项目使用 webpack 打包,由弹出的 create-react-app 构建。
ColumnTypeUndefinedError: Column type for Commodity#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.
Run Code Online (Sandbox Code Playgroud)
按照说明操作。看到反射是在全局范围内。仍然收到错误。从这里推荐哪些步骤?
小智 0
@Column() 必须设置一个类型,例如 @Column('text',{nullable:true})。
更多信息请访问https://github.com/typeorm/typeorm/issues/2897