I am new to NodeJS and TypeScript so this question may be stupid but still it kind of bugs me. I have installed typings for NodeJS generatly they consist of the lattest node.ts.d. The problem I see is that when I create instance of a NodeJS core module (example var fs = require("fs");) I can't specify var fs to be of concrete NodeJS module type (example fs:IFileSystem = require("fs")). Question is why node.ts.d does not contain such interface is it intentional or what is the reason not to include such NodeJS core modules interfaces which seams logical ?
1 Answer
Use import to import modules:
import fs = require('fs');
And you will get autocompletion (if corresponding typings are installed).
1 Comment
Hivaga
I am trying to understand more the reason why such interface is not created, instead just to solve the problem with auto-completion. Kind of understand it better instead of just using it.
import * as fs from "fs". You don't need to manually assign a type.