Despite having babel-plugin-transform-typescript-metadata
installed I have this error below:
ColumnTypeUndefinedError: Column type for Exercise#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.
I have tried this alternate plugin implementation but to no availI am using typescript and I have import 'reflect-metadata';
in relevant codes..
Here are my codes
Exercise.tsx
import {Entity,Column, PrimaryGeneratedColumn} from "typeorm/browser";@Entity("Exercise")export class Exercise{ @PrimaryGeneratedColumn() id!:number; @Column() name!: Text; @Column() notes:Text; @Column() imageJSON:Text;}
.babelrc
{"plugins": ["babel-plugin-transform-typescript-metadata", ["@babel/plugin-proposal-decorators", { "legacy": true }], ["@babel/plugin-proposal-class-properties", { "loose": true }], ],"presets": ["@babel/preset-typescript" ] }
snippet of package.json
..."devDependencies": {"@babel/core": "^7.12.9","@types/node": "^18.0.0","@types/react": "~17.0.21","@types/react-native": "~0.66.13","babel-plugin-transform-typescript-metadata": "^0.2.2","typescript": "~4.3.5" },...
tsconfig.json
{"compilerOptions": {"experimentalDecorators": true,"emitDecoratorMetadata":true, },"extends": "expo/tsconfig.base","compileOnSave": true,"include":["entities" ]}