* test(structures): add test for Emoji structure
* test: use realistic snowflake ids
* test(structures): getters that rely on isIdSet return null if no id set
* style: compress into one test
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* feat(structures): presence structures
* feat(structures): add GatewayPresenceActivityTimestamps substructure
* feat(structures): add GatewayPresenceActivitySecrets
* feat(structures): add GatewayPresenceActivityParty
* feat(structures): add GatewayPresenceActivityEmoji
* feat(structures): add GatewayPresenceActivityButton
* feat(structures): add GatewayPresenceActivityAssets
* feat(structures): add ActivityFlagBitFields
* feat(structures): add GatewayPresenceActivity structure
* docs(structures): update class remark on GatewayPresenceActivityButton
* feat(structures): add GatewayPresenceClientStatus
* feat(structures): add GatewayPresenceUpdate
* docs(structures): update `GatewayPresenceActivity#flags` for clarity
* fix(structures): return correct value for getter on ActivitySecrets
* test(structures): add tests & use correct type on ActivityTimestamps
* docs: rm todo comment
* fix: correct incorrect implementation of party#id
* chore: rename structures
* feat(structures): update tests, comments, date getters
* feat: split `size` into 2 different getters
* test: update tests for new getters
* refactor(structures)!: use xDate convention in favour of xAt
* fix(structures): add `inviteCoverImage` getter + update tests
* test(structures): apply review feedback
* chore: use `dateToDiscordISOTimestamp` and cleanup tests
* feat: isArrayFieldSet typeguard & tidy up
* feat(structures): add URL getters, typeguards, update tests
* test(presence): review feedback
* test(presence): use realistic values
This uses values from the Discord API docs.
* test: rename tests to Presence instead of GatewayPresence
* test(structures): review feedback
* docs: use new discord docs links in jsdoc
* fix: address feedback for tests
Make some changes to all tests;
- use a standard beforeEach block to use a new instance on each test for robustness;
- check that the patched result contains the expected patched values as opposed to testing for any change across the structure, for accuracy.
lazy() used defaultValue ??= cb(), so a callback returning null or undefined
was never cached and re-ran on every call, breaking the compute-once contract
(any side effect in the callback repeated). Track a called flag instead of
relying on value nullishness.
- `Client#pings` is documented as public in the JSDoc, shows up on the
documentation site, but was typed as `private` for some reason
- rename `Client#packetQueue` to `incomingPacketQueue` since
`packetQueue` doesn't exist
- remove `ApplicationCommand.isAPICommandData`, which seemingly never
actually existed at runtime
* fix(VoiceConnection): handle close codes that should not reconnect
* docs(VoiceConnection): update close code documentation
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* chore(api-extractor): adapt upstream changes
* chore: guess it does fix our issue after all...
* chore: use `options` as synthetic name
---------
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix(collection): preserve ReadonlyCollection through tap/each
`each` and `tap` return polymorphic `this`, which TypeScript resolves
against the `Omit<Collection, ...>` portion of `ReadonlyCollection`
rather than the full intersection. That let callers reach `set` and
`delete` on the result of a chain started from a `ReadonlyCollection`:
const ro: ReadonlyCollection<string, number> = new Collection(...);
ro.tap(() => {}).set('x', 0); // compiled, mutated the underlying Map
The fix omits `each` and `tap` from the base `Omit` and re-declares
them on the `ReadonlyCollection` side of the intersection so the return
type narrows back to `ReadonlyCollection`.
Closes#10514
* test(collection): gate readonly-chain checks behind if(false)
Previously the `@ts-expect-error` lines still executed the `set` and
`delete` mutations at runtime, and the final `size === 1` passed only
because they happened to cancel out. Wrapping the assertions in
`if (false)` keeps the compile-time guarantee while the backing
collection is truly untouched, and adds a `get('a') === 1` check as
a belt.
* test(collection): move readonly type checks to *.test-d.ts
Addresses review feedback. The type-level assertions around tap() and
each() preserving ReadonlyCollection belong in a *.test-d.ts file so
they run through vitest's typecheck pass instead of runtime.
Replaces the if(false)-gated @ts-expect-error block in collection.test.ts
with expectTypeOf assertions in a new collection.test-d.ts. Covers both
the no-thisArg and with-thisArg overloads of tap and each.