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

Unexpected [ts] errors in JavaScript files #54261

Closed
ghost opened this issue Jul 13, 2018 · 41 comments
Closed

Unexpected [ts] errors in JavaScript files #54261

ghost opened this issue Jul 13, 2018 · 41 comments
Assignees
Labels
info-needed Issue requires more information from poster javascript JavaScript support issues

Comments

@ghost
Copy link

ghost commented Jul 13, 2018

  • VSCode Version: 1.25.1
  • OS Version: macOS 10.13.6

zrzut ekranu 2018-07-13 o 16 45 52
zrzut ekranu 2018-07-13 o 16 46 11
zrzut ekranu 2018-07-13 o 16 46 18
zrzut ekranu 2018-07-13 o 16 46 51

Disabling extensions seems not change anything.

Of course, I have chosen 'JavaScript' language mode.
zrzut ekranu 2018-07-13 o 16 51 35

@Tyriar Tyriar added the javascript JavaScript support issues label Jul 13, 2018
@vscodebot vscodebot bot removed the new release label Jul 16, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jul 16, 2018

TypeScript powers our javascript language support as well. Please share the text of the code along with screenshots

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Jul 16, 2018
@ghost
Copy link
Author

ghost commented Jul 17, 2018

I shared screenshots in the first issue message. This errors seems to show in different places, without any logic.

while (document.querySelector('.ingredientList').children.length > 0) {
  document.querySelector('.ingredientList').removeChild(document.querySelector('.ingredientList').children[0]);
}

The word 'document' is underlined, and [ts] errors says:
'while' expected,
Expression expected,
')' expected,

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 17, 2018

I can't repo this. Does this reproduce in the latest VS Code insiders build with all extensions disabled? Also, do the errors go away if you edit the document? (just try adding whitespace somewhere)

@davidcoleman007
Copy link

davidcoleman007 commented Jul 18, 2018

I have this same problem using do expressions in jsx files.

to reproduce it, use a do expression in jsx syntax.

image

I get this in the "problems" pane:
image

i didn't even have the tslint extension installed, so i've installed it, and then I've tried disabling tslint. I've tried excluding **/*.js* files. it doesn't work.

I've configured my ES lint to ignore do expressions and that's working, but I can't turn off the ts errors in the js files.

I've tried configuring tslint in my preferences as so:

{
    ...the rest of my prefs
    "tslint.exclude"                            : "**/*.js*",
    "tslint.enable"                             : false,
}

it doesn't work

I've tried adding a tslint.json to my project with the content:

{
  "rules": {
    "no-unused-expression": false
  }
}

it doesn't work.

I've never used my vs code for typescript. Except for the things i've mentioned here, all my ts settings are whatever comes out of the box.

The error occurs with all extensions disabled.

Editing the document makes no difference.

@ghost
Copy link
Author

ghost commented Jul 18, 2018

@davidcoleman007 is absolutely right.

@mjbvz I have a lot of [ts] errors in JSX syntax but also in normal JavaScript code. The error occurs with all extensions disabled. Sometimes when I close document and open it again errors disappears, sometimes not.

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 18, 2018

@davidcoleman007 Our built-in js support only the current ecmascript standard. If you are using proposed syntax like do notation, at the very least you must set "javascript.validate.enabled": false to disable error reporting on js files. IntelliSense and other language features may also not work. The babel extensions in the marketplace may help too but they do not match our built-in js support feature-wise

@donacellos Please provide a complete example of your code as text

@marktellez
Copy link

I too am getting lots of ts errors in my js code. VScode used to be the best editor, now it is a heaping pile of bugs.

@ghost
Copy link
Author

ghost commented Jul 21, 2018

@mjbvz Errors are in almost EVERY code in my projects - missing semicolons on comments, missing while operator in the middle on string etc. When I close VS Code they disappears, as I type new stuff they appear again in completely different places. Now, in macOS Activity Monitor, I saw that Code process takes 100% CPU. Next strange behaviour. @marktellez is right.

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 21, 2018

@marktellez The example code you shared is invalid JavaScript. The TS in the name indicates that the error comes from the Ts extension which powers both JS and TS intellisense. You can disable that error reporting by setting ”javascript.validate.enable”: false

@donacellos Please provide a complete example of your code as text

@davidcoleman007
Copy link

davidcoleman007 commented Jul 21, 2018

@mjbvz why do i have to disable the entire feature? Can't i just turn off THAT error rule. It's not even typescript. why do I have to deal with ts lint issues in a JS file? I have properly configured my eslint to handle do expressions. TSlint should allow me to do the same, and disable that rule. As a matter of fact, to my previous point, I should be able to opt to not do ANY tslint-ing in my js files, I like the ts intellisense. In fact it's one of the most appealing features of the editor.

@ghost
Copy link
Author

ghost commented Jul 21, 2018

@mjbvz

Example of JS

export default () => {
  if (process.env.NODE_ENV !== 'development' && 'serviceWorker' in navigator) {
    window.addEventListener('load', () => {
      navigator.serviceWorker.register('/service-worker.js').then((registration) => {
        console.log('SW registered: ', registration);
      }).catch((registrationError) => {
        console.log('SW registration failed: ', registrationError);
      });
    });
  }
};

Example of JSX

const App = () => (
  <Provider store={store}>
    <BrowserRouter>
      <Aux>
        <Header />
        <div className="container">
          <Switch>
            <Route exact path="/" component={RentalList} />
            <Route exact path="/search/:city" component={RentalSearchList} />
            <ProtectedRoute exact path="/create" component={RentalCreate} />
            <ProtectedRoute exact path="/manage/rentals" component={RentalManage} />
            <ProtectedRoute exact path="/manage/bookings" component={BookingManage} />
            <LoggedInRoute exact path="/login" component={Login} />
            <LoggedInRoute exact path="/register" component={Register} />
            <Route exact path="/rentals/:id" component={RentalDetail} />
          </Switch>
        </div>
      </Aux>
    </BrowserRouter>
  </Provider>
);

You are having troubles with [ts] errors in pure JavaScript? Disable whole JavaScript validation feature. Seems legit, great support.

@marktellez
Copy link

marktellez commented Jul 21, 2018 via email

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 21, 2018

@davidcoleman007 we cannot provide intellisense if we can’t parse your code. Thats one tradeoff of using experimental language features

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 23, 2018

@donacellos And that code in a blank file show errors for you? Can you share the code from your original screenshots too

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 23, 2018

Also @marktellez, cut it out. I'm just trying to help you. According to github email notifications at least, the first snippet you posted (and then deleted at some point) was:

const Gene = () = ({
value: null,
type: null,
fitness: -1,
})

export default Gene

If you are still seeing problems, open a new issue with your code and I'll take a look

@davidcoleman007
Copy link

folllowing this convo and I agree that we should keep it professional. We are trying to work towards improving vs code for ourselves and everyone else who uses it.

steps off soapbox

@mjbvz is there ANY chance that I could disable the ts unused expressions rule some how, and let the intellisense just not work in those blocks, but work for the rest of the file w/o throwing a bunch of red all over the place?

or maybe there is some api that allows me to build in the code from babel stage 0/1 into vscode to extend it much the way the community has done for eslint?

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 23, 2018

@davidcoleman007 Yes the two settings you want are "editor.showUnused": false for unused (faded out) variables and "javascript.validate.enable": false to disable all error reporting. IntelliSense will still be enabled but, as I said, we can't guarantee it will work, especially inside of expressions or statements that use experimental syntax

@davidcoleman007
Copy link

Thank you. I will try this when I get a moment over the next day or 2.

@ehynds
Copy link

ehynds commented Jul 24, 2018

Just wanted to +1 this issue. I've been seeing it for over a month now and haven't been able to hone in on reliable steps to reproduce. Sometimes restarting vscode fixes it for a short period of time, other times it does not. I've tried disabling all extensions but it still happens.

Also, this is a dupe of #53247 which was recently closed (unfortunate) due to lack of STR.

Edit: I'm also finding that the file type doesn't matter. Happens with both Javascript and Javascript React.

@ghost
Copy link
Author

ghost commented Aug 4, 2018

@mjbvz Can't you understand that this is not able to reproduce? Errors appear in random places, random files (JavaScript, JavaScript React, even Markdown sometimes) and random code parts. They sometimes disappears after closing document or adding new character to it, sometimes they don't. Sometimes I have to select all code and simply cut&paste it to get rid of these errors.

My original screenshoots from first issue message - they do not appear anymore. Now they appear in other places. I think @ehynds talks about the same problems.

@joshjg
Copy link

joshjg commented Aug 7, 2018

This definitely seems to be related to performance issues (memory leak in electron_node electronForkStart.js tsserver.js?). The [ts] errors might be valid when they first appear, but as you continue editing the file they "get stuck" and the duration for which they are stuck seems to correlate with the amount of memory usage by tsserver.js.

@illusive-man
Copy link

illusive-man commented Aug 14, 2018

+1 to the issue. Just created index.js and put there export default from './Wrapper';. That leads to underlining './Wrapper' with red and gives [ts] ';' expected error. Why? Just Why?! And the funniest and saddest thing at the same time that if you put semicolon after 'from' word the error disappear. Cool solution, isn't it? I believe that even integrated linters have to have enable/disable setting for an easy control. Annoying bug to say the least.

@JourdanClark
Copy link

My javascript files are covered in [ts] errors because we use experimentalDecorators, which I have enabled for javascript in the settings. I have disabled every typescript and javascript setting I can find and I haven't been able to open a file without getting blasted with a million [ts] errors since 2 or 3 updates ago. No one on my team has been able to get them to go away either. This is a problem on Windows 10 and Mac (idk what versions). After the first update where this was an issue, I downloaded the nightly build, copied over my settings and installed all my plugins, and it worked just fine. Haven't tried a recent nightly build though.

If I type bob?.jeff I'll get [ts] Expression expected.

"javascript.format.enable": false,
"javascript.suggestionActions.enabled": false,
"javascript.validate.enable": false,
"typescript.format.enable": false,
"typescript.suggestionActions.enabled": false,
"typescript.tsc.autoDetect": "off",
"typescript.validate.enable": false,
"javascript.implicitProjectConfig.experimentalDecorators": true,

@illusive-man
Copy link

@JourdanClark , sorry to disappoint you, but that does nothing at all in my case! As if VS Code just ignores those settings! That stubborn & stupid error is still there ((.

But thanks for interesting point about experimental decorators. Got rid of some errors in other files.

@ghost
Copy link
Author

ghost commented Aug 16, 2018

@justintemps Dude, this setting is connected with TSLint extension, this errors appears on default VSCode TS/JS checking.

@mattrlong
Copy link

Im also seeing TS errors across JS files 🤔 I don't have any TS linting extensions installed.

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 5, 2018

@donacellos Please try collecting the TS Server log using VS Code 1.27:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a folder with a tsserver.log file in it

Please share the log file from a session that had the errors in the wrong place

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@vscodebot vscodebot bot closed this as completed Sep 13, 2018
@vscodebot
Copy link

vscodebot bot commented Sep 13, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@garretteklof
Copy link

@mjbvz Is there a way to disable javascript validation, but preserve the "showUnused" functionality? VSCode is throwing a [ts] error because of the :: operator, and I want to kill those, but keep the 'fading out' of unused variables (inherited a messy codebase). I tried "javascript.validate.enable": false, "editor.showUnused": true but no go. Otherwise, any suggestion to circumvent that one :: operator error through VSCode.

@JourdanClark
Copy link

JourdanClark commented Sep 13, 2018

@garretteklof I finally figured out how to disable the [ts] errors. Go to Extension view, search for @builtin javascript, and disable TypeScript and JavaScript Language Features. It worked for me anyways.

Edit: Keep in mind that this disables the built in linting. That is fine in my case because I rely on the ESLint plugin to do my linting, but if you don't have something like that set up then you'll probably want to set up ESLint or some other linting tool when you disable what VSCode ships with.

@garretteklof
Copy link

@JourdanClark thanks a lot for the reply -- that looks like a possible alternative to "javascript.validate.enable": false, but unfortunately does seem to disable the greying out of unused variables/imports too. There may not be a way to isolate the feature.

@Jikodis
Copy link

Jikodis commented Sep 19, 2018

@mjbvz Here is the section of my tsserver.log that mentions the [ts] errors. The code I was working on is for an Udemy class on Gulp. Does this shed any light on the scenario? These errors are causing a lot of visual noise and are crowding out actual errors in the code.

I can confirm that when I disable the 'TypeScript and JavaScript Language Features' version 1.0.0 built in extension that the errors go away. However, I really like the JavaScript language features. It would be nice to not pair both languages in the same extension.

Below you can see in the image a bunch of [ts] errors. Some are on the 'require' statement and others on the 'require' parameters.

On a side note, why did this issue close 5 days ago? I see the latest comment before the closing of this ticket was 13 days ago. That means only 8 days passed before this ticket closed.

image

tsserver.log:

Info 123  [17:10:47.711] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"c:/Users/username/Desktop/gulp-website/gulpfile.js","diagnostics":[{"start":{"line":1,"offset":12},"end":{"line":1,"offset":27},"text":"File is a CommonJS module; it may be converted to an ES6 module.","code":80001,"category":"suggestion"},{"start":{"line":3,"offset":26},"end":{"line":3,"offset":43},"text":"Could not find a declaration file for module 'gulp-livereload'. 'c:/Users/username/Desktop/gulp-website/node_modules/gulp-livereload/index.js' implicitly has an 'any' type.\n  Try `npm install @types/gulp-livereload` if it exists or add a new declaration (.d.ts) file containing `declare module 'gulp-livereload';`","code":7016,"category":"suggestion"},{"start":{"line":5,"offset":5},"end":{"line":5,"offset":14},"text":"'minifyCss' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true},{"start":{"line":12,"offset":5},"end":{"line":12,"offset":15},"text":"'handlebars' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true},{"start":{"line":12,"offset":26},"end":{"line":12,"offset":43},"text":"Could not find a declaration file for module 'gulp-handlebars'. 'c:/Users/username/Desktop/gulp-website/node_modules/gulp-handlebars/index.js' implicitly has an 'any' type.\n  Try `npm install @types/gulp-handlebars` if it exists or add a new declaration (.d.ts) file containing `declare module 'gulp-handlebars';`","code":7016,"category":"suggestion"},{"start":{"line":13,"offset":5},"end":{"line":13,"offset":18},"text":"'handlebarsLib' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true},{"start":{"line":14,"offset":5},"end":{"line":14,"offset":12},"text":"'declare' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true},{"start":{"line":14,"offset":23},"end":{"line":14,"offset":37},"text":"Could not find a declaration file for module 'gulp-declare'. 'c:/Users/username/Desktop/gulp-website/node_modules/gulp-declare/index.js' implicitly has an 'any' type.\n  Try `npm install @types/gulp-declare` if it exists or add a new declaration (.d.ts) file containing `declare module 'gulp-declare';`","code":7016,"category":"suggestion"},{"start":{"line":15,"offset":5},"end":{"line":15,"offset":9},"text":"'wrap' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true},{"start":{"line":15,"offset":20},"end":{"line":15,"offset":31},"text":"Could not find a declaration file for module 'gulp-wrap'. 'c:/Users/username/Desktop/gulp-website/node_modules/gulp-wrap/index.js' implicitly has an 'any' type.\n  Try `npm install @types/gulp-wrap` if it exists or add a new declaration (.d.ts) file containing `declare module 'gulp-wrap';`","code":7016,"category":"suggestion"}]}}
Info 124  [17:10:47.712] event:
    {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":8}}
Info 125  [17:10:51.410] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 126  [17:10:51.546] Elapsed:: 136ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 127  [17:10:51.546] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 128  [17:10:51.546] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 129  [17:10:51.546] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/README.md :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 130  [17:10:51.546] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/README.md :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 131  [17:10:51.546] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/index.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 132  [17:10:51.624] Elapsed:: 78ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/index.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 133  [17:10:51.625] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 134  [17:10:51.690] Elapsed:: 65ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 135  [17:10:51.691] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/README.md :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 136  [17:10:51.691] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/README.md :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 137  [17:10:51.691] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/index.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 138  [17:10:51.763] Elapsed:: 72ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/index.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 139  [17:10:51.763] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 140  [17:10:51.827] Elapsed:: 64ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 141  [17:10:51.827] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 142  [17:10:52.5] Elapsed:: 178ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 143  [17:10:52.5] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 144  [17:10:52.5] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging/types-registry-1a62120b :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 145  [17:10:52.7] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 146  [17:10:52.195] Elapsed:: 188ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 147  [17:10:52.196] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json.4073882689 :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 148  [17:10:52.196] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json.4073882689 :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 149  [17:10:52.198] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 150  [17:10:52.299] Elapsed:: 101ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 151  [17:10:52.299] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json.4073882689 :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 152  [17:10:52.299] Elapsed:: 0ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json.4073882689 :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 153  [17:10:52.301] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 154  [17:10:52.359] Elapsed:: 58ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/types-registry/package.json :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 155  [17:10:52.366] DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 156  [17:10:52.544] Elapsed:: 178ms DirectoryWatcher:: Triggered with C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/.staging :: WatchInfo: C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules 1 Project: /dev/null/inferredProject1* WatchType: Directory of Failed lookup locations in module resolution
Info 157  [17:10:53.106] Received response:
    {"projectName":"/dev/null/inferredProject1*","typeAcquisition":{"enable":true,"include":[],"exclude":[]},"compilerOptions":{"module":1,"target":3,"jsx":1,"allowJs":true,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"noEmitForJsFiles":true,"maxNodeModuleJsDepth":2},"typings":["C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/eslint/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-autoprefixer/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-concat/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-minify-css/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-plumber/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-sass/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-sourcemaps/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/gulp-uglify/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/handlebars/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/async/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/js-base64/index.d.ts","C:/Users/username/AppData/Local/Microsoft/TypeScript/3.0/node_modules/@types/sprintf/index.d.ts"],"unresolvedImports":[],"kind":"action::set"}

gulpfile.js:

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');

//Handlebars plugins
var handlebars = require('gulp-handlebars');
var handlebarsLib = require('handlebars');
var declare = require('gulp-declare');
var wrap = require('gulp-wrap');

// File paths
var DIST_PATH = 'public/dist';
var SCRIPTS_PATH = 'public/scripts/**/*.js';

// SCSS Styles
gulp.task('styles', function(){
    console.log('Starting styles task');

    return gulp.src('public/scss/styles.scss')
    .pipe(plumber(function(error){
        console.log('Styles task error');
        console.log(error);
        this.emit('end');
    }))
    .pipe(sourcemaps.init())
    .pipe(autoprefixer())
    .pipe(sass({
        outputStyle: 'compressed'
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(DIST_PATH))
    .pipe(livereload());
});

// Scripts
gulp.task('scripts', function(){
    console.log('Starting scripts task');

    return gulp.src(SCRIPTS_PATH)
        .pipe(plumber(function(error){
            console.log('Scripts task error\n' + error);
            this.emit('end');
        }))
        .pipe(sourcemaps.init())
        .pipe(babel({
            presets: ['es2015']
        }))
        .pipe(uglify())
        .pipe(concat('scripts.js'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(DIST_PATH))
        .pipe(livereload());
});

// Images
gulp.task('images', function(){
    console.log('Starting images task');
});

// Watch
gulp.task('watch', function(){
    console.log('Starting watch task');
    require('./server.js');
    livereload.listen();
    gulp.watch(SCRIPTS_PATH, ['scripts']);
    // gulp.watch(CSS_PATH, ['styles']);
    gulp.watch('public/scss/**/*.scss', ['styles']);
});

// Default
gulp.task('default', function(){
    console.log('Starting default task');
});

@illusive-man
Copy link

illusive-man commented Sep 19, 2018

The hint to disable "TypeScript and JavaScript Language Features" extension did help in may case as well, but the hint itself is next to something like "To avoid such errors just stop using VS Code and switch to another editor". No go, sorry.

And I don't understand why is this issue not the one of high priority ones still. It's ruining VS Code experience completely. Imagine if in PHP files it would pop Symphony or Laravel errors without having latter ones even installed. Nonsense!

@david-middleton-at-resolver

While disabling the "TypeScript and JavaScript Language Features" extension resolved the issue, upgrading to VSCode 1.27.2 also seems to do the trick.

@illusive-man
Copy link

While disabling the "TypeScript and JavaScript Language Features" extension resolved the issue, upgrading to VSCode 1.27.2 also seems to do the trick.

Nope, 1.27.2 has nothing to do with that. Only disabling the extension helps.

@JourdanClark
Copy link

JourdanClark commented Sep 19, 2018

After upgrading to 1.27.2 and enabling "TypeScript and JavaScript Language Features", I no longer get [ts] errors when using optional chaining, ie

const name = bob?.name;

@illusive-man What error are you getting? Can you provide an example of some code that is giving you the error? You have upgraded to 1.27.2, correct (you can check your version by going to Help -> About)?

Edit: In 1.27.2 (With "TypeScript and JavaScript Language Features" enabled) I am unable to replicate the error you get from export default from './Wrapper';, even when I remove "@babel/plugin-proposal-export-default-from" and "@babel/plugin-proposal-export-namespace-from" from my .babelrc. I also tried enabling "typescript.validate.enable" and "javascript.validate.enable" in my user settings and I didn't receive an error.

@Jikodis
Copy link

Jikodis commented Sep 19, 2018

@JourdanClark @illusive-man @david-middleton-at-resolver ,
Look at my comment above. I am on version 1.27.2 and I am still getting errors with this code:

image

@illusive-man
Copy link

@JourdanClark, please, mate - don't tell me how to check software version. It's kinda stupid. If I told you that in 1.27.2 I still have that [ts] error it means that (surprise!) in 1.27.2 I still have that [ts] error. :)

ts_errorjpg

@Jikodis, no need to tell that to me, I'm in the same boat! )

@YuriGor
Copy link

YuriGor commented Sep 23, 2018

User.test.js:

import mongoose from 'mongoose';
import User from '../../../server/models/User';

require('dotenv').config();

const { MONGO_URL_TEST } = process.env;

describe('slugify', () => {
  beforeAll(() = {
    mongoose.connect(MONGO_URL_TEST);
  });
  test('no duplication', () => {
    expect.assertions(1);
    return User.remove()
      .then(() => User.signInOrSignUp({
        googleId: 'test1',
        email: 'test1@test.ts',
        googleToken: { accessToken: 'test1', refreshToken: 'test1' },
        displayName: 'Test Name',
        avatarUrl: 'test1',
      }))
      .then((user) => {
        // console.log('user created', user);
        expect(user.slug).toBe('test-name');
      });
  });
});

typo in beforeAll(() = //missed '>' here cause 1 valid [eslint] error, but also 3 unexpected [ts] errors further in the code.
VSCode 1.27.2
DotENV 1.0.1
ESLint 1.6.0
Prettier - Code Formatter 1.6.1

@cweekly
Copy link

cweekly commented Oct 15, 2018

I'm on VSC 1.28.1 (macOS 10.13.6).
I never installed any TS-related extensions.
Grateful to @JourdanClark for the tip:

"... Extension view, search for @Builtin javascript, and disable TypeScript and JavaScript Language Features."

which finally resolved the nonsensical TS linting suggestions from my es6 projects.

@ivarlovlie
Copy link

var export = something gives me export= can only be used in a .ts file. as an error in vanilla js. Only js validation is enabled in my settings, and i still get ts errors.

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests