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

Cannot "import { NameValueUnits } from" #4076

Closed
ghost opened this issue Jul 29, 2015 · 7 comments
Closed

Cannot "import { NameValueUnits } from" #4076

ghost opened this issue Jul 29, 2015 · 7 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@ghost
Copy link

ghost commented Jul 29, 2015

Note: I am not trying to get help fixing my code. I am only reporting what I think is a bug in typescript.

See branch "AddVS15" of https://github.com/kevinpas/Klib6

There are two imports in the startup file "Klib6/Tests/Core/CoreTests.ts". If you comment out the second one you can successfully run and debug/step through the tests in the startup file.

If you uncomment the second import and uncomment the two lines near the bottom:
//var units = "mm";
//var nameValueUnits = new NameValueUnits( name, value, units );

when you try to run it you get the exception (on win7):

Debugger listening on port 5858
module.js:338
throw err;
^
Error: Cannot find module 'NameValue'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (C:\ ... \Git\GitHub\Klib6\Source\Core
\NameValueUnits.js:46:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Press any key to continue...

@ghost
Copy link
Author

ghost commented Jul 29, 2015

In the branch AddVS15 of https://github.com/kevinpas/Klib6

there is a Tools folder. In that folder there is a vs 15 project that should be used.

@mhegazy
Copy link
Contributor

mhegazy commented Jul 29, 2015

This is a node issue. it can not find a module "NameValue" the issue is that you are using module "NameValue" without a relative path, which tells node to find a package with this name.

in NameValueUnits.ts change

import { NameValue } from "NameValue";

to

import { NameValue } from "./NameValue";

I understand that you wanted the compiler to flag this instead figuring it out yourself. If you have a proposal on how to do that we would be open to discussing it.

@mhegazy mhegazy added Question An issue which isn't directly actionable in code Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Jul 29, 2015
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript and removed Question An issue which isn't directly actionable in code labels Jul 29, 2015
@ghost
Copy link
Author

ghost commented Jul 29, 2015

It is a difficult problem.

But it doesn't seem to be the natural intent of the new import keyword. I have no suggestions other than passing import another parameter telling it the callers perspective.

@DanielRosenwasser
Copy link
Member

Is this a duplicate of #294 or related to #2338?

@mhegazy
Copy link
Contributor

mhegazy commented Jul 30, 2015

I believe they are related. I wounder if #2338 will fix this. pinging @vladima.

@ghost
Copy link
Author

ghost commented Jul 31, 2015

Merged my branch back into master.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 22, 2016

this should be working correctly today. please reopen if this is not the case.

@mhegazy mhegazy closed this as completed Feb 22, 2016
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Feb 22, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants