#Type error: Invalid module name in augmentation, module 'payload' cannot be found.

1 messages · Page 1 of 1 (latest)

harsh goblet
#

I am using the payload generated type in my frontend and I get this error:

Type error: Invalid module name in augmentation, module 'payload' cannot be found.

for the file which is generated using payload generate:types:

// rest of stuff
declare module 'payload' {
    export interface GeneratedTypes extends Config {}
}

I dont want to delete this line every time I copy this file to my client side, is it possible to not output that?

alpine trenchBOT
shell terrace
#

@harsh goblet you can omit the module declaration by specifying typescript.declare in payload.config.ts like so:

export default buildConfig({
  typescript: {
    outputFile: path.resolve(__dirname, 'payload-types.ts'),
    declare: false
  },
})
harsh goblet
#

thanks