I am trying to create a Typescript definition for the NodeJS formidable module that I want to use to upload files to the server. But that throws an error. The typescript compiler does not compile the statement "import formidable = require('formidable');" to its javascript equivalent. I need to know if the formidable definition is correct.
Here's the upload.ts which contains the file parse code:
import fs = require('fs');
import path = require('path');
import formidable = require('formidable');
var formidable = new formidable.Formidable();
Here's the upload.js which is created by the typescript compiler:
var fs = require('fs');
var path = require('path');
var formidable = new formidable.Formidable();
The typescript compiler is not creating a require statement for the formidable module. this needs to be fixed.
Here's the typescript definition file:
/// <reference path="../Main.d.ts" />
declare module "formidable" {
export interface Formidable {
IncomingForm(): Formidable;
}
}