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 bug is with typescript 2.7.0-dev.20180116 or with typescript 2.6.2.
I thought is a node bug, so I've already report the bug at nodejs/node#18185. I've tried with Node.js 6.12.3 or 9.4.0. I've tried on Linux 4.14.13-1-ck x86_64.
import{MyClass}from'./';exportfunctionSimpleFunction(){console.log(newMyClass());};// worksexportconstSimpleModule=console.log(newMyClass());// Doesn't work
And in server.ts we have:
import{MyClass,SimpleModule,SimpleFunction}from'./';console.log(SimpleFunction);// worksconsole.log(newMyClass());// worksconsole.log(SimpleModule);// Doesnt work
npm install && node node_modules/typescript/bin/tsc
We could see in appJS/index.js than at line 9 and 10 we have:
.................../strangeErrorIndexDotTs/appJS/simple.module.js:7
exports.SimpleModule = console.log(new _1.MyClass()); // Doesn't work
^
TypeError: _1.MyClass is not a constructor
at Object.<anonymous> (................/strangeErrorIndexDotTs/appJS/simple.module.js:7:36)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (.................../strangeErrorIndexDotTs/appJS/index.js:9:10)
at Module._compile (module.js:660:30)
In app/index.ts replace line 4 by line 5 and line 5 by line 4.
You should have :
In the original project (see 1.) we could see than:
console.log(new MyClass()); in server.ts works (contrary to the same code in simple.module.ts).
* In simple.module.ts: export function SimpleFunction() {console.log(new MyClass());}; works contrary to export const SimpleModule = console.log(new MyClass());
The text was updated successfully, but these errors were encountered:
The compiler makes no grantees in the face of circular imports. seems like you are trying to import MyClass thought a cycle, and the result is undefined.
This bug is with typescript 2.7.0-dev.20180116 or with typescript 2.6.2.
I thought is a node bug, so I've already report the bug at nodejs/node#18185. I've tried with Node.js 6.12.3 or 9.4.0. I've tried on Linux 4.14.13-1-ck x86_64.
strangeErrorIndexDotTs.zip.
In app/index.ts you could see the code at line 4 and 5
./myclass is only a declaration of class: (
In sample.module.ts we have:
And in server.ts we have:
npm install && node node_modules/typescript/bin/tsc
We could see in appJS/index.js than at line 9 and 10 we have:
node appJS/server.js
You could see the error:
You should have :
rm -R appJS && node node_modules/typescript/bin/tsc
:You could see in appJS/index.js than lines 9 and 10 are reversed:
node appJS/server.js
: it works.In the original project (see 1.) we could see than:
console.log(new MyClass());
in server.ts works (contrary to the same code in simple.module.ts).* In simple.module.ts:
export function SimpleFunction() {console.log(new MyClass());};
works contrary toexport const SimpleModule = console.log(new MyClass());
The text was updated successfully, but these errors were encountered: