Skip to content

Commit 4c2fb4e

Browse files
committed
docs: updatae readmes
1 parent b537f97 commit 4c2fb4e

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ _React Bindings_
6767
- [Important Notes](#important-notes-1)
6868
- [Live Demo](#live-demo-5)
6969
- [Notes](#notes)
70+
- [TypeScript module augments](#typescript-module-augments)
7071
- [Avatar shortcuts](#avatar-shortcuts)
7172
- [Profile shortcuts](#profile-shortcuts)
7273
- [Theming](#theming)
@@ -346,6 +347,23 @@ that the browser can support. The live demo below uses Vite.
346347

347348
## Notes
348349

350+
### TypeScript module augments
351+
352+
This library uses a custom object on the browser `window` for configuration.
353+
Under normal circumstances by simply importing the package (with
354+
`import @skyra/discord-components-core`) the module augmentations should also be
355+
loaded. If for whatever reason this does not happen, then you can define them
356+
manually yourself. You can do so with the following code snippet:
357+
358+
```ts
359+
import type { DiscordMessageOptions } from '@skyra/discord-components-core';
360+
361+
declare global {
362+
// eslint-disable-next-line no-var
363+
var $discordMessage: DiscordMessageOptions | undefined;
364+
}
365+
```
366+
349367
### Avatar shortcuts
350368

351369
The current avatar shortcut strings available are "blue" (default), "gray",

packages/core/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ _React Bindings_
6868
- [Important Notes](#important-notes-1)
6969
- [Live Demo](#live-demo-5)
7070
- [Notes](#notes)
71+
- [TypeScript module augments](#typescript-module-augments)
7172
- [Avatar shortcuts](#avatar-shortcuts)
7273
- [Profile shortcuts](#profile-shortcuts)
7374
- [Theming](#theming)
@@ -354,6 +355,23 @@ that the browser can support. The live demo below uses Vite.
354355

355356
## Notes
356357

358+
### TypeScript module augments
359+
360+
This library uses a custom object on the browser `window` for configuration.
361+
Under normal circumstances by simply importing the package (with
362+
`import @skyra/discord-components-core`) the module augmentations should also be
363+
loaded. If for whatever reason this does not happen, then you can define them
364+
manually yourself. You can do so with the following code snippet:
365+
366+
```ts
367+
import type { DiscordMessageOptions } from '@skyra/discord-components-core';
368+
369+
declare global {
370+
// eslint-disable-next-line no-var
371+
var $discordMessage: DiscordMessageOptions | undefined;
372+
}
373+
```
374+
357375
### Avatar shortcuts
358376

359377
The current avatar shortcut strings available are "blue" (default), "gray",

packages/react/README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ _React Bindings_
5353
- [Live Demo App Directory](#live-demo-app-directory)
5454
- [Known limitations](#known-limitations)
5555
- [Notes](#notes)
56+
- [TypeScript module augments](#typescript-module-augments)
5657
- [Avatar shortcuts](#avatar-shortcuts)
5758
- [Profile shortcuts](#profile-shortcuts)
5859
- [Theming](#theming)
@@ -191,6 +192,23 @@ per React's own documentation. We very strongly recommend using Vite instead.
191192

192193
## Notes
193194

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+
194212
### Avatar shortcuts
195213

196214
The current avatar shortcut strings available are "blue" (default), "gray",
@@ -208,7 +226,7 @@ The current avatar shortcut strings available are "blue" (default), "gray",
208226

209227
If you want to add to or override the shortcuts, you can set them via
210228
`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'`).
212230

213231
```ts
214232
window.$discordMessage = {
@@ -221,7 +239,7 @@ window.$discordMessage = {
221239
```
222240

223241
```ts
224-
import { setConfig } from '@skyra/discord-components-core';
242+
import { setConfig } from '@skyra/discord-components-react';
225243

226244
setConfig({
227245
avatars: {
@@ -237,7 +255,7 @@ setConfig({
237255
Sometimes you'll want to use the same message data across multiple messages. You
238256
can do so by providing an object of profiles in
239257
`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'`).
241259

242260
```ts
243261
window.$discordMessage = {
@@ -259,7 +277,7 @@ window.$discordMessage = {
259277
```
260278

261279
```ts
262-
import { setConfig } from '@skyra/discord-components-core';
280+
import { setConfig } from '@skyra/discord-components-react';
263281

264282
setConfig({
265283
profiles: {

0 commit comments

Comments
 (0)