fix(components): augment 'vue' module rather than overwriting (#305)

This commit is contained in:
Daniel Roe 2021-07-07 19:41:51 +01:00 committed by GitHub
parent 2abac1d78c
commit b53d8a77ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 26 deletions

View File

@ -3,35 +3,33 @@ import { $Fetch } from 'ohmyfetch'
import { Nuxt } from '../dist' import { Nuxt } from '../dist'
declare global { declare global {
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var $fetch: $Fetch var $fetch: $Fetch
namespace NodeJS { namespace NodeJS {
interface Global { interface Global {
$fetch: $Fetch $fetch: $Fetch
}
interface Process {
browser: boolean
client: boolean
mode: 'spa' | 'universal'
server: boolean
static: boolean
}
} }
interface Process {
browser: boolean
client: boolean
mode: 'spa' | 'universal'
server: boolean
static: boolean
}
}
interface Window { interface Window {
__NUXT__?: Record<string, any> __NUXT__?: Record<string, any>
} }
} }
declare module '*.vue' { declare module '*.vue' {
export default Vue export default Vue
} }
declare module 'vue' { declare module 'vue' {
interface App { interface App {
$nuxt: Nuxt $nuxt: Nuxt
} }
} }
export {}

View File

@ -5,3 +5,6 @@ declare module 'vue' {
}).join(',\n') %> }).join(',\n') %>
} }
} }
// export required to turn this into a module for TS augmentation purposes
export { }

View File

@ -7,5 +7,5 @@ declare global {
} }
} }
// type export required to turn this into a module for TS augmentation purposes // export required to turn this into a module for TS augmentation purposes
export type A = {} export { }

View File

@ -21,5 +21,3 @@ declare module '#assets' {
export function statAsset(id: string): Promise<AssetMeta> export function statAsset(id: string): Promise<AssetMeta>
export function getAsset<T=any>(id: string): { read: () => Promise<T>, meta: AssetMeta } export function getAsset<T=any>(id: string): { read: () => Promise<T>, meta: AssetMeta }
} }
export {}