Node.js + TypeScript FileSystem issue

31 views
Skip to first unread message

Sergey Gonchar

unread,
Jun 14, 2015, 3:05:51 PM6/14/15
to nod...@googlegroups.com
Hello! I have a simple typescipt program 
/// <reference path="node-definitions/node.d.ts" />
import fs = require('fs');
fs.writeFileSync("test.txt","HelloWorld");

when I run it, it says that fs is empty https://www.dropbox.com/s/ygvfi8us4mdignd/Screenshot%202015-06-11%2010.11.12.png?dl=0

the generated js code is correct https://www.dropbox.com/s/egl06maalnsd04e/Screenshot%202015-06-11%2010.21.24.png?dl=0

if I require other modules, for instance require(“path”) all is ok but require(“fs”) always returns empty Object as I see they are declared inside node.d.ts in the same way (“path” and “fs” modules) also I have tried different versions of node.d.ts and node.js (0.10 - 0.12) 

Maybe someone know how to solve this issue?

p.s. clear js program with filesystem works perfectly

Reply all
Reply to author
Forward
0 new messages