The error message:
Argument of type '{ readonly entities: readonly [typeof Post]; readonly dbName: "lireddit"; readonly type: "postgresql"; readonly debug: boolean; }' is not assignable to parameter of type 'Configuration<IDatabaseDriver> | Options<IDatabaseDriver> | undefined'. Type '{ readonly entities: readonly [typeof Post]; readonly dbName: "lireddit"; readonly type: "postgresql"; readonly debug: boolean; }' is not assignable to type 'Options<IDatabaseDriver>'. Type '{ readonly entities: readonly [typeof Post]; readonly dbName: "lireddit"; readonly type: "postgresql"; readonly debug: boolean; }' is not assignable to type 'Partial<MikroORMOptions<IDatabaseDriver>>'. Types of property 'entities' are incompatible. The type 'readonly [typeof Post]' is 'readonly' and cannot be assigned to the mutable type '(string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema<any, undefined>)[]'.ts(2345)
The index.ts:
import { MikroORM } from '@mikro-orm/core';
import { __prod__ } from './constants';
import { Post } from './entities/Post';
import mikroConfig from './mikro-orm.config';
const main = async() => {
const orm = await MikroORM.init(mikroConfig);
const post = orm.em.create(Post, {title:'ez az első posztom hehe'})
await orm.em.persistAndFlush(post)
}
main().catch((err) => {
console.error(err)
})
And the mikro-orm.config.ts:
import { Post } from "./entities/Post";
import { __prod__ } from "./constants";
export default {
entities:[Post],
dbName: "lireddit",
type: "postgresql",
debug : !__prod__,
} as const;
Thank you for the help i you can, its so painful