I’m trying to create a Nuxt 3 project based on installation guide: https://nuxt.com/docs/getting-started/installation.
I followed it step by step. But when i want to configure nuxt.config.ts
and i paste sample config file from https://nuxt.com/docs/getting-started/configuration:
export default defineNuxtConfig({
runtimeConfig: {
// The private keys which are only available server-side
apiSecret: '123',
// Keys within public are also exposed client-side
public: {
apiBase: '/api'
}
}
})
I’m getting a typescript error:
Argument of type '{ runtimeConfig: { apiSecret: string; public: { apiBase: string; }; }; }' is not assignable to parameter of type 'NuxtConfig'.
Object literal may only specify known properties, and 'runtimeConfig' does not exist in type 'NuxtConfig'.ts(2345)
I’m using node version 16.16.0 and Visual Studio Code is my IDE.
2
Answers
I had to update typescript version from 4.7.3 to 5.0.4 and change settings of vsc to use newer version.
Update Typescript IntelliJ
the second solution to add
made the tric, and intellij detected automatically the good version