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
It gives me a strange error as if it had conversion problems and converted the StringSource to an object.
constname='script.ts';constsource='export class Some { }';consttsc=require('typescript-compiler');console.log(source,name);constsrc=newtsc.StringSource(source,name);console.log(src);constjs=tsc.compileString(src);console.log(js);
I get this weird error with the codeframe all messed up:
exportclassSome{}script.tsStringSource{contents: 'export class Some { }',filename: 'script.ts',type: 1}{sources: {},sourceMaps: [],errors: ['error TS6053: File \'export class Some { }.ts\' not found.\n']}{[SyntaxError: script.ts: Unexpectedtoken(1:8)]pos: 8,loc: Position{line: 1,column: 8},_babel: true,codeFrame: '\u001b[0m> 1 | \u001b[33m[\u001b[39mobject Object\u001b[33m]\u001b[39m\n | ^\u001b[0m'}
SyntaxError: script.ts: Unexpectedtoken(1:8)>1|[objectObject]|^atParser.pp.raise(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/location.js:22:13)atParser.pp.unexpected(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/util.js:91:8)atParser.pp.expect(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/util.js:83:33)atParser.pp.parseExprList(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:993:12)atParser.pp.parseExprAtom(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:476:28)atParser.pp.parseExprSubscripts(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:270:19)atParser.pp.parseMaybeUnary(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:250:19)atParser.pp.parseExprOps(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:180:19)atParser.pp.parseMaybeConditional(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:157:19)atParser.pp.parseMaybeAssign(/Users/andy/Development/selfstudy-ng2/node_modules/babylon/lib/parser/expression.js:120:19){source: 'export class Some { }',err:
{[SyntaxError: script.ts: Unexpectedtoken(1:8)]pos: 8,loc: Position{line: 1,column: 8},_babel: true,codeFrame: '\u001b[0m> 1 | \u001b[33m[\u001b[39mobject Object\u001b[33m]\u001b[39m\n | ^\u001b[0m'}}
Not sure where to start, sorry.
The text was updated successfully, but these errors were encountered:
I got further. Calling compileString doesn't really do anything if there are errors (I had assumed it would throw errors when onError was not defined.) After seeing the first errors I realized that I needed a command line to be passed for this to do anything.
Now I have:
This will work for simple typescript sources but no matter what I do I was unable to get it to understand decorators. Is there something else I have to do? I am also confused about command line versus compiler options versus --project settings. They seems to override each other in unexpected ways.
It gives me a strange error as if it had conversion problems and converted the StringSource to an object.
I get this weird error with the codeframe all messed up:
Not sure where to start, sorry.
The text was updated successfully, but these errors were encountered: