You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can only be used in ts files, cannot find name Handler*
here:
import express from "express";
import React from "react";
import Router from "react-router";
const app = express();
// set up Jade
app.set('views', './views');
app.set('view engine', 'jade');
import routes from "../shared/routes";
app.get('/*', function (req, res) {
Router.run(routes, req.url, Handler => {
////////////////// This can only be used in ts files, cannot find name Handler ////////////////
let content = React.renderToString(<Handler />);
////Block Scoped Variable used before its declaration/////
res.render('index', { content: content });
});
});
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
The same problem occurs when trying to use ES7 async/await syntax, which can be used with Babel or in newest Edge/Chakra versions.
Imo jsconfig.json is completely unnecessary. Why do I need to set compilerOptions when I'm targeting a modern JS engine and not compiling anything? A better option would be to enable everything by default and then auto-detect .babelrc files (or the same for Traceur) and if one exists, look at the constraints defined there.
It uses Electron core. But the JS linting is handled by TypeScript I believe for the IntelliSense support (which, I have to say, is so much better than Atom)
Any workarounds? If VSCode can't handle the ES6+JSX syntax, I need some way to get it out of the way. Otherwise, everyone's going to tell me to get knotted and go back to Sublime Text.
var HARDCODED_NAME = 'TODO';
var HARDCODED_VERSION = '0.2.3';
function foo() {
var props = {
name: HARDCODED_NAME,
version: HARDCODED_VERSION,
};
// '>' expected.
// ',' expected.
// ',' expected.
// Expression expected.
// Expression expected.
// This can only be used in ts files.
console.log(props);
}
module.exports = foo;
All those errors get displayed as hover-over on the squiggly red line under the ; in the line ending props.
Any workarounds? If VSCode can't handle the ES6+JSX syntax, I need some way to get it out of the way. Otherwise, everyone's going to tell me to get knotted and go back to Sublime Text.
In 0.10.6 you can disable the validation using a setting
"javascript.validate.enable": true
In 0.10.7 that will become available this week, we provide a preview of the new JS infrastructure that supports JSX, pls give it a try.
Activity
felixfbecker commentedon Nov 21, 2015
The same problem occurs when trying to use ES7
async/awaitsyntax, which can be used with Babel or in newest Edge/Chakra versions.Imo jsconfig.json is completely unnecessary. Why do I need to set
compilerOptionswhen I'm targeting a modern JS engine and not compiling anything? A better option would be to enable everything by default and then auto-detect .babelrc files (or the same for Traceur) and if one exists, look at the constraints defined there.daslicht commentedon Nov 21, 2015
isn't VS Code based on Atom?
In Atom I didn't get those Errors.
felixfbecker commentedon Nov 21, 2015
It uses Electron core. But the JS linting is handled by TypeScript I believe for the IntelliSense support (which, I have to say, is so much better than Atom)
daslicht commentedon Nov 21, 2015
Yeah
jrieken commentedon Dec 10, 2015
We will make JSX better supported in the near future
garthk commentedon Jan 31, 2016
Any workarounds? If VSCode can't handle the ES6+JSX syntax, I need some way to get it out of the way. Otherwise, everyone's going to tell me to get knotted and go back to Sublime Text.
garthk commentedon Feb 1, 2016
[UPDATE: if you're seeing "This can only be used in ts files." in your plain JavaScript, drop in a
jsconfig.jsonfile.]Worse, Johannes Rieken (@jrieken),
I'm seeing this error in plain ES5-compatibile JavaScript:All those errors get displayed as hover-over on the squiggly red line under the
;in the line endingprops.egamma commentedon Feb 1, 2016
In 0.10.6 you can disable the validation using a setting
In 0.10.7 that will become available this week, we provide a preview of the new JS infrastructure that supports JSX, pls give it a try.
chrisdias commentedon Feb 2, 2016
here is how to get 0.10.7 build: https://code.visualstudio.com/insiders
jrieken commentedon Mar 14, 2016
Closed with the adoption of Salsa.