discordjs / discord.js-typings Goto Github PK
View Code? Open in Web Editor NEWOfficial TypeScript type definitions for Discord.js
License: Other
Official TypeScript type definitions for Discord.js
License: Other
Line 1424 of index.d.ts
.
In the documentation, the type for createMessageCollector() is MessageCollectorOptions, which conflicts with the typings here.
Hey,
I was looking for type definitions for discord.js and I was surprised no has contributed types to Definetely Typed yet. Is there a reason you are maintaining them in your own Repo instead of contributing to DefinetelyTyped?
The return type for DMChannel.send()
is string
in index.d.ts, but according to the discord.js documentation this should be Promise<Message | Message[]>
as it is for GroupDMChannel
and TextChannel
.
node_modules/discord.js/typings/index.d.ts(60,23): error TS2304: Cannot find name 'Set'. node_modules/discord.js/typings/index.d.ts(62,22): error TS2304: Cannot find name 'Set'. node_modules/discord.js/typings/index.d.ts(267,40): error TS2304: Cannot find name 'Map'. node_modules/discord.js/typings/index.d.ts(1182,20): error TS2304: Cannot find name 'Map'. node_modules/discord.js/typings/index.d.ts(1333,23): error TS2304: Cannot find name 'Set'. node_modules/discord.js/typings/index.d.ts(1334,22): error TS2304: Cannot find name 'Set'.
I believe a typing needs to be added for GuildMemberRoleStore#sweep
.
I've noticed that this repo uses mostly type aliases.
The TypeScript documentation recommends using interfaces over type aliases if possible. For example, TextBasedChannelFields
should probably be:
interface TextBasedChannelFields extends PartialTextBasedChannelFields {
typing: boolean;
// other fields...
}
Yarn or pnpm doesn't work with git submodules. So it would be nice to separate it out from the master and also publish it as @types/discord.js
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=member
The definition should be:
member(user: UserResolvable): GuildMember | undefined;
Other methods which may return undefined are probably similarly mistyped.
The namespace used, 'discord.js'
, is somewhat troublesome.
There is no way to represent the namespace name used in jsdoc.
The dot suggest there is a sub namespace, discord > js, and you can't put quotes around it.
Also, in the documentation for discord.js, it's always imported as Discord
, thus it would make sense that the namespace is called Discord
.
This will make it a lot easier as the compiler will automatically include the files.
It's also what most libraries do.
MessageOptions.files should be of type FileOptions[] | BufferResolvable[] | Attachment[]
In index.js "Constants" is exported, but typings for the class don't exist.
it happens when compiling my ts project
"[email protected]",
you should just change
export class Collection<K, V> extends Map<K, V> {
into
export class Collection<K, V> implements Map<K, V> {
here is my tsconfig
{
"compilerOptions": {
/* Basic Options */
"target": "ES5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "./.build/", /* Redirect output structure to the directory. */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"strictFunctionTypes": true, /* Enable strict checking of function types. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
}
}
I'm unable to install the v10.0.0 typings via npm due to the package.json file not having name
property.
$ npm install --save git+https://github.com/zajrik/discord.js-typings.git#de59a23685c90429719111a4d5b7bd1cf57b2031
...
npm ERR! No name provided in package.json
...
Could you add a How to use section in the readme. This is the first time I've tried to use Typescriptand am coming a bit unstuck
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.