typeorm / react-native-example

Example project to demonstrate TypeORM with React Native.
68 stars 29 forks source link

Cloumn type not defined #3

Closed shouhuori closed 5 years ago

shouhuori commented 5 years ago
Column type for Contact#title 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.

my Contact.ts:

import {Entity, Column, PrimaryGeneratedColumn} from "typeorm/browser";

@Entity()
export class Contact{
  @PrimaryGeneratedColumn()
  id!: number;

  @Column()
  title!: string;

  @Column()
  text!: string;
}
shouhuori commented 5 years ago

@Column() must set a type,like @Column('text',{nullable:true})