fmajestic / betterdiscord-types

Type definitions for BetterDiscord.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BetterDiscord Types

Typescript type definitions for BetterDiscord.

Usage

npm install @types/betterdiscord@github:zerthox/betterdiscord-types

Note: When installing under a name not starting with @types, definitions for globals may not be included. Importing the module somewhere or using for example typeRoots can fix this.

import type { Patcher, Filters } from "betterdiscord";

Custom Data Type

A custom type for BetterDiscord's BdApi.Data interface may be supplied. This enables more specific typing for Data's functions.

When used from BdApi directly, Data needs to be casted:

import type { Data } from "betterdiscord";

const TypedData = BdApi.Data as Data<CustomDataType>;

When using a bound version of BdApi, the custom type can be supplied in the constructor:

const BoundBdApi = new BdApi<CustomDataType>("PluginName");

About

Type definitions for BetterDiscord.

License:MIT License