-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): add types for process.sentry (#153)
Extending a namespace must be done in a definition file that has no top-level imports so that the file is treated as ambient module rather than a normal module. For that reason, I couldn't just put new code in `index.d.ts` but had to create separate file. Stuff from `index.d.ts` moved to `extend.d.ts` to have a cleaner structure.
- Loading branch information
Showing
3 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as SentryTypes from '@sentry/minimal'; | ||
|
||
// add type to Vue context | ||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} | ||
|
||
// App Context and NuxtAppOptions | ||
declare module '@nuxt/types' { | ||
interface Context { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
|
||
interface NuxtAppOptions { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} | ||
|
||
// add types for Vuex Store | ||
declare module 'vuex/types' { | ||
interface Store<S> { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,2 @@ | ||
import * as SentryTypes from '@sentry/minimal'; | ||
|
||
// add type to Vue context | ||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} | ||
|
||
// App Context and NuxtAppOptions | ||
declare module '@nuxt/types' { | ||
interface Context { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
|
||
interface NuxtAppOptions { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} | ||
|
||
// add types for Vuex Store | ||
declare module 'vuex/types' { | ||
interface Store<S> { | ||
readonly $sentry: typeof SentryTypes; | ||
} | ||
} | ||
import './extend'; | ||
import './node'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare namespace NodeJS { | ||
interface Process { | ||
sentry: typeof import('@sentry/node'); | ||
} | ||
} |