node.js - TypeScript / NodeJS: variable not defined, using internal ref paths for separate files -
i have been testing typescript node, going until tried splitting these out.
am forced use modules ?
i have 2 files, app.ts has reference path hellofile.tst
/// <reference path="hellofile.ts" /> var testme = new hello() console.log(testme.testme()); and hellofile.ts contains
class hello { testme():string { return "hello"; } } now running program (i using webstorm), following error.
/usr/local/bin/node app.js / users/tst/webstormprojects/nodejswithtypescript/app.js:2 var testme = new hello(); ^ referenceerror: hello not defined @ object.<anonymous> (/users/tst/webstormprojects/nodejswithtypescript/app.js:2:18) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3 process finished exit code 8
any or ideas appreciated
thanks
you don't have use modules. can compile --out flag
but external modules commonjs highly recommended if targeting nodejs : http://m.youtube.com/watch?v=kdrwlmuy0r0
Comments
Post a Comment