nuxt-security: Upgrading to 2.0.0 causes server RuntimeConfig variables to be type "unknown"

Nuxt version: 3.13.2 Nuxt-security version: 1.4.3

I’m not sure if this is a bug or it’s just an issue with my config, so I’ll just ask it as a question.

But basically I’m trying to upgrade our Nuxt-security module from 1.4.3 --> 2.0.0. But I’m getting type errors where RuntimeConfig variables are being cast as type unknown, but they are expected to be type string.

error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'.

This is only seems to be the case though for files in our app server/api folders. RuntimeConfig variables used outside of the server/apis folders don’t seem to throw this error. I tried deleting the server folder and then running again with the upgrade and it seems the errors disappear.

Also on Nuxt-security version 1.4.3, then these errors don’t occur. Only when I upgrade to 2.0.0.

Could it be related to this? https://github.com/Baroshem/nuxt-security/issues/319

Thank you in advance.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (2 by maintainers)

Most upvoted comments

Renovate managed to install v.2.0.0 successfully without me doing anything, so maybe was a problem with another module. I will close this, thanks for the help.

As pointed out by @vejja this change was a recommendation from Daniel so I believe we would need to keep it this way.

If you agree guys, I would be up for closing this ticket as won't fix as it is how the @nuxt/module-builder works now.

If you remove the Nuxt-security module, the TS errors disappear, right?