TypeScript + Node.js FileSystem issue -
i have simple typescipt program
/// <reference path="node-definitions/node.d.ts" /> import fs = require('fs'); fs.writefilesync("test.txt","helloworld");
when run it, says fs empty https://www.dropbox.com/s/ygvfi8us4mdignd/screenshot%202015-06-11%2010.11.12.png?dl=0
the generated js code correct https://www.dropbox.com/s/egl06maalnsd04e/screenshot%202015-06-11%2010.21.24.png?dl=0
if require other modules, instance require(“path”) ok require(“fs”) returns empty object see declared inside node.d.ts in same way (“path” , “fs” modules) have tried different versions of node.d.ts , node.js (0.10 - 0.12) maybe know how solve issue?
for nodejs compile typescript commonjs
module format i.e.
tsc app.ts --module commonjs
Comments
Post a Comment