I'm currently working on setting up MikroORM with PostgreSQL, but I've encountered a strange error related to the type:
Here is the code snippet:
import { MikroORM, Options} from "@mikro-orm/core";
import { _prod_ } from "./constants";
import { Post } from "./entities/Post";
const main = async () => {
const config: Options =
const orm = await MikroORM.init({
entities: [Post],
dbName: "readit",
type: "postgresql", <<-- encountering error here
debug: !_prod_,
});
const post = orm.em.create(Post, {title:'First post'})
}
main();
The specific error message I'm receiving is:
Object literal may only specify known properties, and 'type' does not exist in type 'Options<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>'.
I have been referring to the documentation, but this error seems confusing and unclear.
Could this be an issue with TypeScript?
I attempted to make some adjustments in the TypeScript settings, but it hasn't resolved the issue yet.
This is my tsconfig.json configuration:
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"baseUrl": "."
},
"exclude": ["node_modules"],
"include": ["./src/**/*.ts"]
}