What's up with "import declarations may only appear at top level of a module"
Kent Williams <[email protected]> Tue, 12 Jun 2018 17:05:52 -0500
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
So SpiderMonkey 52 supports ES6, and we're embedding the TypeScript
compiler. I got that part working but I get an error compiling the
compiled scripts.
"compilation exception: import declarations may only appear at top level
of a module: file: , line: 1"
This is my test program:
import Add from "./TSTest2";
let x:string='Hello from Typscript\n';
print_doc(x + Add(2,2).toString() + '\n');
// cause_an_error;
And this is the module it's trying to import:
export default function Add(x: number, y:number): number {
return x + y;
}
When I google that error message, all the references to <script> tags in
client side JS. How do I get a server-side SpiderMonkey interpreter to
not throw that error.
_______________________________________________
dev-tech-js-engine mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine