Skip to content

TS compiler thinks express "errorhandler" module isn't a module #3612

@wardbell

Description

@wardbell

I'm using tsc Version 1.5.0-beta

I tried to switch from standard node require syntax to import for several common express packages. TS allows this conversion for some, but not all packages ... and I cannot tell what accounts for the difference.

Here are four packages w/ the original require syntax

import express = require("express")
import bodyParser = require("body-parser");
import methodOverride = require("method-override");
import errorHandler = require("errorhandler");

Here they are again w/ import

import * as express from 'express';                 // OK
import * as bodyParser from 'body-parser';          // OK
import * as methodOverride from 'method-override';  // fails
import * as errorHandler from 'errorhandler';       // fails

of course the code actually runs because the imports transpile to the requires form that I traditionally write in JS

var express = require("express");
var bodyParser = require("body-parser");
var methodOverride = require("method-override");
var errorHandler = require("errorhandler");

Inspecting the code within these packages does not reveal differences that suggest to me an obvious explanation.

For convenience, the npm package.json for these packages is:

    "express": "4.11.1",
    "body-parser": "1.10.2",
    "errorhandler": "1.3.2",
    "method-override": "2.3.1"

FWIW "body-parser" and "method-override" are both quite short.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions