NuxtN
Nuxt6mo ago
14 replies
Vex

Nuxt4 tsconfig issues

I am using Mikro-ORM with Nuxt 4 and getting the following type errors when using decorators:

@Entity({ tableName: 'roles' })
export class Role {
    @PrimaryKey()
    id: string = v4();
    //...
}


Unable to resolve signature of property decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'Partial<any>'.ts(1240)

So I have added the following to my nuxt.config.ts:

typescript: {
        tsConfig: {
            compilerOptions: {
                experimentalDecorators: true,
                emitDecoratorMetadata:  true,
                esModuleInterop:        true,
            },
        },
    },


However I cannot see these options in any of the generated tsconfig files in the .nuxt directory and the type error persists. I have also tried adding them to the root tsconfig.json file, with no success.

Am I missing something?
Was this page helpful?