-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Throws syntax error for valid syntax #553
Comments
That error comes from babel (see stack trace) and is caused by registering babel for |
@blakeembrey Thank you for your response. When I try removing babel, I get errors with Here are my babel versions:
async saveCourse(event) {
^^^^^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Module.m._compile (C:\dev\zach\project\node_modules\ts-mocha\node_modules\ts-node\src\index.ts:392:23)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .tsx] (C:\dev\zach\project\node_modules\ts-mocha\node_modules\ts-node\src\index.ts:395:12) |
This is an issue with babel unfortunately, they're reading directly from file circumventing |
@blakeembrey I can definitely try the babel beta, thank you for the suggestion! I was attempting to target Here is my {
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "esnext",
"jsx": "react"
},
"include": [
"./src/**/*"
]
} |
@zposten Target |
I'm in the process of creating a React v16 app with Redux v4 and Typescript v2.7. I'm having an odd issue where ts-node, when running my tests, exhibits different behavior than awesome-typescript-loader, that I use to build and run my project.
It's specifically around a particular instance of the
as
keyword. This is complicated further by the fact that I'm using a version of redux-thunk that currently resides in a pull request in order to allow redux-thunk to support Redux v4 with Typescript.Running
ts-node scirpt.ts
onscript.ts:
configureStore.ts:
generates the following error:
The fact that it's a syntax error really confuses me. Because that same exact code runs fine with webpack and awesome-typescript-loader, and I believe it to be valid syntax. The
as
keyword works elsewhere, so what makes this particular instance invalid?Also, if you put all this code in the same file and don't
require
one from the other, the issue does not happen!! That doesn't make any sense to me.ts-node --version
returns the following:The problem as described here is reduced as far as I could get it, but if it's helpful, I've published a
testsFail
branch here on the project I'm working on where the issue originates from. To see it, clone the project, check out thetestsFail
branch, and runnpm install
. Then replacenode_modules/redux-thunk/index.d.ts
with this one from the aforementioned pull request. And finally runnpm test
to see the error. If you go to the previous commit, the tests will pass butnpm start
will fail.Thank you in advance for any help!
The text was updated successfully, but these errors were encountered: