-
Notifications
You must be signed in to change notification settings - Fork 12.8k
import statement broken from migration 1.0.3 to 1.1 or higher #954
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I've been having similar issues with TS 1.1, which is why I'm still on 1.0 for now. I haven't delved into it as much as @epinxteren here, but I remember my errors were similar. |
The behavior does appear to have changed here and broken things. Could you describe your build setup a little more? How is your module loading system finding |
I'm using AMD with requirejs. I'm not moving any files around and not using Node to execute the files. Document structure path is: Requirejs config looks like this:
So at runtime the import statement: would work perfectly fine: Js version: RequireJs would resolve the file as: Of course i'm minifying and combining files for production use, but this is not relevant. The cool things is TypeScript also finds the definition of BatteryIncluded/TextWriter completely different path like:
And it works in 1.0: LogController.ts
The 1.0 version could find any import statement inside those path's, what is very handy. |
Same problem when compiling to CommonJS modules. Workaround, when developing Node.JS (commonjs) modulus /// <reference path="../../typings/node/node.d.ts" />
declare var require; // TODO: bad hack to make TSC compile, possible reason https://github.com/Microsoft/TypeScript/issues/954
var crypto = require('crypto');
// sample usage
var mac = crypto.createHmac('sha256', key); Any chances to fix this soon? |
I have searched the github project for any release changes bud my import statements are broken from a code migration of 1.0.3 to version 1.1 or higher. (http://stackoverflow.com/questions/26543594/import-statement-broken-from-migration-1-0-3-to-1-1-or-higher)
Directory structure:
Code Registry.ts:
Code TextWriter.ts:
In typescript version 1.0.3 the error would not occur. But in version 1.1 or higher the error is:
Using typescript in the form of:
To fix this problem i can use the import statement:
import TextWriter = require("./TextWriter");
This is not desired because all deeply nested files i need to do something like this:
import TextWriter = require("../../../TextWriter");
Before could just use:
import TextWriter = require("BatteryIncluded/TextWriter");
I have searched on TypeScript GitHub repro for release changes that could imply this error, but couldn't find any.
The text was updated successfully, but these errors were encountered: