Home

Issue: 2823

process.client can't be used in TS based environment

[issue link]

Since I’ve updated to Nuxt v. 1.3.0 I started getting a deprecation warning inside my middleware functions:
context.isClient has been deprecated, please use process.client instead.
but I can’t change my code to use process.client instead because of TS error:

TS2339: Property 'client' does not exist on type 'Process'.

so it seems like this change was made without TS in mind.
A workaround was suggested by @qm3ster

declare namespace NodeJS {
  export interface Process {
    client: boolean
    server: boolean
  }
}

but I guess such considerations should be done on the Nuxt level.
The issue was discovered when working with nuxt-community/typescript-template

This question is available on Nuxt.js community (#c2453)