fix(Types): replace never usage with void#1526
fix(Types): replace never usage with void#1526PapiOphidian wants to merge 3 commits intodiscordjs:mainfrom
Conversation
|
@PapiOphidian is attempting to deploy a commit to the discordjs Team on Vercel. A member of the Team first needs to authorize it. |
Which ones? 👁️ |
|
Also should we use |
|
I think for types like this one:
|
|
I'm confused what that type even is, cuz surely its not an object of keys... |
|
It was the heartbeat and reconnect packets that I couldn't change to void without some ts errors. I hadn't considered undefined, but I do believe undefined could work better and it addresses the issue of those packets not being able to be changed from never. I've updated the usages I'd previously updated as well as documentation |
Please describe the changes this PR makes and why it should be merged:
closes #1522
The majority of the usage of
neverin the project does not align with the semantics of the keyword and this PR replaces them withvoid. The keyword implies the value being typed asnevercannot be observed under any conditions such as in the case of only throwing an exception orprocess.exit(), which is not true in cases of where these types would be used such as return types for routes that return an HTTP 204 which is an OK status code.It's also used in some gateway payloads which is also technically incorrect as attempting to access the values at runtime would produce an observable
undefined.Some of the base types for gateway payloads that would have been modified would not work to be replaced as void, so those have been kept.
API v6-v8 also has not been modified as those had clear deprecation comments, but it was assumed that api v9 was still being maintained, so types from v9 have also been modified.
Some markdown mentioning the usage of never has also been modified.
If applicable, please reference Discord API Docs PRs or commits that influenced this PR:
N.A.