Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

added extraData generic type to manager #413

Closed
wants to merge 7 commits into from
Closed

added extraData generic type to manager #413

wants to merge 7 commits into from

Conversation

imranbarbhuiya
Copy link
Contributor

@imranbarbhuiya imranbarbhuiya commented Jan 2, 2022

Changes

  • added extraData generic type to manager so that it can give autocomplete in gw start options, edit and all. x-ref refactor: import timers, event, from node:聽#412
  • also change declare module to top level d.ts with exports
  • discord.js is now a dev dependency. Also added v13.0.0 in peer deps.

I did this because every user will be downloading djs, so there is no need to redownload the same.

Status

  • These changes have been tested and formatted properly.
  • This PR includes only documentation changes (JSDoc, README or typings), no code change.
  • This PR introduces some breaking changes.

How to use these generic types?

You can use ExtraData interface in GiveawayManager's generic type. It's optional, if u don't provide the type it'll become any type as before.

  const manager = new GiveawayManager<ExtraData>(client, {
    default: {
      botsCanWin: false,
      embedColor: "#03FEE0",
      embedColorEnd: "#ffffff",
      reaction: "馃帀",
    },
  });

Now you'll get autocomplete and validation in giveaway start options also.
image

If you are extending the manager to change generate embed, then you can add the extraData generic type in Giveaway class

generateMainEmbed(
    giveaway: Giveaway<ExtraData>,
    lastChanceEnabled = false
  ): MessageEmbed {
}

added extraData generic type to manager so that it can give autocomplete in gw start options, edit and all.
also change declare module to top level d.ts with exports
discord.js is now a dev dependency. Also added v13.0.0 in peer deps.
@imranbarbhuiya
Copy link
Contributor Author

imranbarbhuiya commented Jan 2, 2022

I accidentally edited in my last pr clone. Because of that all my last pr commits are also present here, idk how I can remove them now without recreating. Should I recreate or squash and merge will work?

@imranbarbhuiya
Copy link
Contributor Author

I'm going to recreate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant