Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler does not import module even when its referenced #4675

Closed
pdeva opened this issue Sep 7, 2015 · 1 comment
Closed

Compiler does not import module even when its referenced #4675

pdeva opened this issue Sep 7, 2015 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@pdeva
Copy link

pdeva commented Sep 7, 2015

I have code like this:

import React = require('react');
import ReactRouter = require('react-router');
import cbox = require('./components/commentbox')

import Route = ReactRouter.Route;

var routes = (
  <Route name="app" path="/" handler={cbox.CommentBox}>

  </Route>
);
React.render(
  <cbox.CommentBox />,
  document.getElementById('content')
);

Note that I am clearly referencing and use ReactRouter here to create the Route alias.

However, the code produced does not import react-router:

define(["require", "exports", 'react', './components/commentbox'], function (require, exports, React, cbox) {
    var Route = ReactRouter.Route;
    var routes = (React.createElement(Route, {"name": "app", "path": "/", "handler": cbox.CommentBox}));
    React.render(React.createElement(cbox.CommentBox, null), document.getElementById('content'));
});

Expected Behavior

Since ReactRouter is referenced in the code, the react-router lib should have been in the list of imports.

@mhegazy mhegazy added the Bug A bug in TypeScript label Sep 8, 2015
@mhegazy mhegazy added this to the TypeScript 1.7 milestone Sep 8, 2015
@DiogoDoreto
Copy link

I'm having exactly the same problem, but importing with ES6 style and compiling to system. Note that this only occurs when importing react-router.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants