vscode imports import console = require(“console”); automatically
import console = require("console");
console.
<< I type . and above gets imported automatically in VScode. Anybody knows how to disable that?
(I assume it is one of my extensions. Probably Prettier.)
edit:
it only happens in React Typescript environment. not in Typescript without react.
typescript visual-studio-code
add a comment |
import console = require("console");
console.
<< I type . and above gets imported automatically in VScode. Anybody knows how to disable that?
(I assume it is one of my extensions. Probably Prettier.)
edit:
it only happens in React Typescript environment. not in Typescript without react.
typescript visual-studio-code
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55
add a comment |
import console = require("console");
console.
<< I type . and above gets imported automatically in VScode. Anybody knows how to disable that?
(I assume it is one of my extensions. Probably Prettier.)
edit:
it only happens in React Typescript environment. not in Typescript without react.
typescript visual-studio-code
import console = require("console");
console.
<< I type . and above gets imported automatically in VScode. Anybody knows how to disable that?
(I assume it is one of my extensions. Probably Prettier.)
edit:
it only happens in React Typescript environment. not in Typescript without react.
typescript visual-studio-code
typescript visual-studio-code
edited Nov 14 at 13:34
asked Nov 13 at 10:40
dragonsoul
166
166
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55
add a comment |
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55
add a comment |
1 Answer
1
active
oldest
votes
I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.
As a workaround you can disable autoimports in settings.
If you use Javascript
"javascript.suggest.autoImports": false
If you use Typescript
"typescript.suggest.autoImports": false
EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree
declare module "console" {
export = console;
}
The package can be located in either your local node_modules directory or in a referenced package installed globally.
- Search your local node_modules for
declare module "console"
- If you find it in a local package, run
npm list [packageName]
to determine which package in package.json is dependent on the package with the console code in it.
If you don´t find code in your local node_modules you could either
Eliminate packages one by one in package.json
Search for the console code in globally installed modules which may be referenced by packages in your project
%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript
I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279182%2fvscode-imports-import-console-requireconsole-automatically%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.
As a workaround you can disable autoimports in settings.
If you use Javascript
"javascript.suggest.autoImports": false
If you use Typescript
"typescript.suggest.autoImports": false
EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree
declare module "console" {
export = console;
}
The package can be located in either your local node_modules directory or in a referenced package installed globally.
- Search your local node_modules for
declare module "console"
- If you find it in a local package, run
npm list [packageName]
to determine which package in package.json is dependent on the package with the console code in it.
If you don´t find code in your local node_modules you could either
Eliminate packages one by one in package.json
Search for the console code in globally installed modules which may be referenced by packages in your project
%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript
I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
|
show 1 more comment
I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.
As a workaround you can disable autoimports in settings.
If you use Javascript
"javascript.suggest.autoImports": false
If you use Typescript
"typescript.suggest.autoImports": false
EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree
declare module "console" {
export = console;
}
The package can be located in either your local node_modules directory or in a referenced package installed globally.
- Search your local node_modules for
declare module "console"
- If you find it in a local package, run
npm list [packageName]
to determine which package in package.json is dependent on the package with the console code in it.
If you don´t find code in your local node_modules you could either
Eliminate packages one by one in package.json
Search for the console code in globally installed modules which may be referenced by packages in your project
%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript
I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
|
show 1 more comment
I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.
As a workaround you can disable autoimports in settings.
If you use Javascript
"javascript.suggest.autoImports": false
If you use Typescript
"typescript.suggest.autoImports": false
EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree
declare module "console" {
export = console;
}
The package can be located in either your local node_modules directory or in a referenced package installed globally.
- Search your local node_modules for
declare module "console"
- If you find it in a local package, run
npm list [packageName]
to determine which package in package.json is dependent on the package with the console code in it.
If you don´t find code in your local node_modules you could either
Eliminate packages one by one in package.json
Search for the console code in globally installed modules which may be referenced by packages in your project
%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript
I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.
I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.
As a workaround you can disable autoimports in settings.
If you use Javascript
"javascript.suggest.autoImports": false
If you use Typescript
"typescript.suggest.autoImports": false
EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree
declare module "console" {
export = console;
}
The package can be located in either your local node_modules directory or in a referenced package installed globally.
- Search your local node_modules for
declare module "console"
- If you find it in a local package, run
npm list [packageName]
to determine which package in package.json is dependent on the package with the console code in it.
If you don´t find code in your local node_modules you could either
Eliminate packages one by one in package.json
Search for the console code in globally installed modules which may be referenced by packages in your project
%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript
I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.
edited Nov 23 at 15:27
answered Nov 21 at 6:12
KvD
312
312
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
|
show 1 more comment
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
I think that worked. Thanks!
– user2517182
Nov 21 at 16:39
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 at 8:49
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 at 9:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 at 15:29
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 at 21:12
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279182%2fvscode-imports-import-console-requireconsole-automatically%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
any luck with this? I am having the same issue
– user2517182
Nov 20 at 20:55