question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript errors with MappedInteractionTypes

See original GitHub issue

Which package is this bug report for?

discord.js

Issue description

Note: This is not a duplicate of #7924, strictNullChecks are enabled!

  1. Create a new project using yarn init -y
  2. Install discord.js using yarn add discord.js
  3. Install typescript and node-types using yarn add -D typescript @types/node
  4. Create tsconfig.json and index.ts from the codesample
  5. Run yarn tsc --noEmit
  6. Observe errors in discord.js/typings/index.d.ts

A workaround for this is using skipLibCheck but I’d rather not have to do that since I believe that including the libraries in typechecking is valuable to spot missing external dependencies (like polyfills for DOM API or WebSocket, etc).


One more note regarding the dev build (yarn add discord.js@dev, version number down below): That one does not show the errors mentioned above but a handful other ones regarding the new Builders.

Code sample

`tsconfig.json`

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,

    /* Type Checking */
    "strict": true,
    "strictNullChecks": true,
    "skipLibCheck": false
  }
}

index.ts

import { Client } from "discord.js";

const client = new Client({ intents: [] });
client.login();

Package version

discord.js@14.6.0

Node.js version

Node: 16.13.1, TypeScript 4.8.4

Operating system

Windows 10; 64-bit

Priority this issue should have

Medium (should be fixed soon)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

No Intents

I have tested this issue on a development release

ff85481

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Jiralitecommented, Nov 10, 2022

Any estimates when a new version without library internal typeerrors is going to be released?

No ETA sadly.

I’m actually having the same issue, and setting skipLibCheck to true isn’t going to do for me in the long run.

But… I don’t have a choice right now, so that will do. At the moment, all my types are just going to be linted and not checked by TypeScript.

Having the same issue with strictNullChecks enabled.

strictNullChecks won’t do anything and one does not need to set skipLibCheck to true. Simply override discord-api-types to 0.37.14 in your package.json:

{
  "overrides": {
    "discord-api-types": "0.37.14"
  }
}
1reaction
geisterfurz007commented, Nov 6, 2022

Any estimates when a new version without library internal typeerrors is going to be released?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type `MappedInteractionTypes` Error · Issue #7383 - GitHub
I havent tried to get an error with this but i found out while walking on the types for djs that there is...
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
Documentation - Understanding Errors - TypeScript
Whenever TypeScript finds an error, it tries to explain what went wrong in as much detail as possible. Because its type system is...
Read more >
Interpreting Errors - TypeScript Deep Dive - Gitbook
This example demonstrates a common programmer error where they fail to call a function ( bar: getBar should be bar: getBar() ). Fortunately...
Read more >
How to read TypeScript errors - HipsterBrown
These errors can occur at runtime, build time, or as feedback in editors while the code is being written. When seeing TypeScript errors...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found