@@ -53,6 +53,7 @@ _React Bindings_
53
53
- [ Live Demo App Directory] ( #live-demo-app-directory )
54
54
- [ Known limitations] ( #known-limitations )
55
55
- [ Notes] ( #notes )
56
+ - [ TypeScript module augments] ( #typescript-module-augments )
56
57
- [ Avatar shortcuts] ( #avatar-shortcuts )
57
58
- [ Profile shortcuts] ( #profile-shortcuts )
58
59
- [ Theming] ( #theming )
@@ -191,6 +192,23 @@ per React's own documentation. We very strongly recommend using Vite instead.
191
192
192
193
## Notes
193
194
195
+ ### TypeScript module augments
196
+
197
+ This library uses a custom object on the browser ` window ` for configuration.
198
+ Under normal circumstances by simply importing the package (with
199
+ ` import @skyra/discord-components-react ` ) the module augmentations should also
200
+ be loaded. If for whatever reason this does not happen, then you can define them
201
+ manually yourself. You can do so with the following code snippet:
202
+
203
+ ``` ts
204
+ import type { DiscordMessageOptions } from ' @skyra/discord-components-react' ;
205
+
206
+ declare global {
207
+ // eslint-disable-next-line no-var
208
+ var $discordMessage: DiscordMessageOptions | undefined ;
209
+ }
210
+ ```
211
+
194
212
### Avatar shortcuts
195
213
196
214
The current avatar shortcut strings available are "blue" (default), "gray",
@@ -208,7 +226,7 @@ The current avatar shortcut strings available are "blue" (default), "gray",
208
226
209
227
If you want to add to or override the shortcuts, you can set them via
210
228
` window.$discordMessage.avatars ` or by using the ` setConfig ` function
211
- (` import { setConfig } from '@skyra/discord-components-core ' ` ).
229
+ (` import { setConfig } from '@skyra/discord-components-react ' ` ).
212
230
213
231
``` ts
214
232
window .$discordMessage = {
@@ -221,7 +239,7 @@ window.$discordMessage = {
221
239
```
222
240
223
241
``` ts
224
- import { setConfig } from ' @skyra/discord-components-core ' ;
242
+ import { setConfig } from ' @skyra/discord-components-react ' ;
225
243
226
244
setConfig ({
227
245
avatars: {
@@ -237,7 +255,7 @@ setConfig({
237
255
Sometimes you'll want to use the same message data across multiple messages. You
238
256
can do so by providing an object of profiles in
239
257
` window.$discordMessage.profiles ` or by using the ` setConfig ` function
240
- (` import { setConfig } from '@skyra/discord-components-core ' ` ).
258
+ (` import { setConfig } from '@skyra/discord-components-react ' ` ).
241
259
242
260
``` ts
243
261
window .$discordMessage = {
@@ -259,7 +277,7 @@ window.$discordMessage = {
259
277
```
260
278
261
279
``` ts
262
- import { setConfig } from ' @skyra/discord-components-core ' ;
280
+ import { setConfig } from ' @skyra/discord-components-react ' ;
263
281
264
282
setConfig ({
265
283
profiles: {
0 commit comments