2

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
  • use the import syntax: import * as fs from "fs". You don't need to manually assign a type. Commented Jun 21, 2016 at 16:47

1 Answer 1

1

Use import to import modules:

import fs = require('fs');

And you will get autocompletion (if corresponding typings are installed).

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.