Skip to content

Do not suggest @types installation for relative path with extension in node_modules #19996

@weswigham

Description

@weswigham

TypeScript Version: 2.7.0-dev.201xxxxx

Code

import discord_js_original_js = require("./node_modules/discord.js/src/index.js");

Expected behavior:
Ideally no error if the file is loaded, or

index.ts(3,41): error TS7016: Could not find a declaration file for module './node_modules/discord.js/src/index.js'. 'E:/Github/TypeScript/tests/cases/user/discord.js/node_modules/discord.js/src/index.js' implicitly has an 'any' type.

If it's not found.

Actual behavior:
The above, plus:

  Try `npm install @types/./node_modules/discord.js/src/index.js` if it exists or add a new declaration (.d.ts) file containing `declare module './node_modules/discord.js/src/index.js';`

Both npm install @types/./node_modules/discord.js/src/index.js and declare module './node_modules/discord.js/src/index.js'; are nonfunctional nonsense and aught not to be suggested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions