discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

Type currently unknown `toJSON()` methods

Open papsavas opened this issue 1 year ago • 0 comments

Which package is this feature request for?

discord.js

Feature

Right now there are some structures (Guild, Application, Client, GuildMember etc...) where their JSON type is marked as unknown. This makes it frustrating when you need to provide them to external JSON sources with their respective types

Ideal solution or implementation

An internal JSON type that flattens all required fields accordingly and replaces current toJSON() marked as unknown

Alternative solutions or implementations

A public JSON<T> type helper (such as this) that receives a generic and Flattens it accordingly.

Other context

No response

papsavas avatar Apr 20 '23 18:04 papsavas