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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No intellisense for require in ts files #30531

Open
hediet opened this issue Mar 21, 2019 · 1 comment
Open

No intellisense for require in ts files #30531

hediet opened this issue Mar 21, 2019 · 1 comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@hediet
Copy link
Member

hediet commented Mar 21, 2019

TypeScript Version: 3.4.0-rc
Search Terms: require, intellisense

Typescript does not resolve modules of require expressions as it does in plain js files.

Code

require("s:\\dev\\easy-attach\\")({
    eagerExitDebugProxy: true,
    port: "preconfigured",
    
});

Expected behavior:
This is what I get in VS Code in plain js files:
image

Actual behavior:
However, the module is not resolved in ts files:
image

Probably this is intended and my use case is a very special one.
However, typescripts repository description still says:

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

In this case, typescript has better support for require in js than in ts which is a little bit confusing considering typescript being a superset of javascript.

@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Mar 26, 2019
@hediet
Copy link
Member Author

hediet commented Apr 18, 2020

More use cases:

  • import {} from ... cannot be conditional, but require can be (when targeting NodeJS).
  • require can be used in Webpack when using hot reload to load the reloaded module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants