discordjs / discord.js-modules

Modularisation of discord.js (WIP)
Apache License 2.0
193 stars 30 forks source link

feat:`@discord.js/type-utils` package #57

Open suneettipirneni opened 3 years ago

suneettipirneni commented 3 years ago

Please describe the changes this PR makes and why it should be merged:

Migration of https://github.com/discordjs/discord.js/pull/6410 to package here.

This package offers typeguards for otherwise tedious manual typeguards. It will also eventually offer compatibility with api types and #equals between various types.

Status and versioning classification: Please move lines that apply to you out of the comment:

codecov[bot] commented 3 years ago

Codecov Report

Merging #57 (954d125) into main (ceaab7d) will increase coverage by 0.09%. The diff coverage is 86.79%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
+ Coverage   85.84%   85.93%   +0.09%     
==========================================
  Files           8       11       +3     
  Lines         996     1102     +106     
  Branches       99      113      +14     
==========================================
+ Hits          855      947      +92     
  Misses         42       42              
- Partials       99      113      +14     
Impacted Files Coverage Δ
packages/type-utils/src/lib/util/enum.ts 78.26% <78.26%> (ø)
packages/type-utils/src/lib/button.ts 82.35% <82.35%> (ø)
packages/type-utils/src/lib/command.ts 90.90% <90.90%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ceaab7d...954d125. Read the comment docs.

suneettipirneni commented 3 years ago

So I'm leaning towards renaming this module to type-utils, there are various reason for this:

  1. This module only being for type guards feels a bit limited in scope.
  2. Other utility functions such as #isEqual will offer a lot of utility and also fit under the type-utils category.
  3. I eventually want to add support for all functions to accept discord-api-types variants as well as the d.js variants.

Other than naming, this PR won't change anything, but I wanna keep the door open for later changes.