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
alias imports of namespaced types are failing when using ts-loader with fork-ts-checker-webpack-plugin #644
Comments
I think this may be a fork-ts-checker-webpack-plugin issue rather than a ts-loader one. Do you want to raise your issue there? |
yeah - wasn't sure about it and don't want to cross post. I'll open an issue there |
It's worth saying that I believe namespaces are not advised to be used with modules BTW. I don't have the relevant link but I'm pretty sure that's the case |
hm - would be interesting to get a link for that. |
Yeah - I checked there too. Interestingly I believe the context there is internal modules. Could be worth looking on stackoverflow - I believe one of the core team answers and question about this. Or something like that |
I've created a simple example repository to reproduce the issue:
https://github.com/alfrescian/fork-ts-checker-issue
I've an index.ts that does the following alias import of a type defined in a namespace:
import foo = myNamespace.foo;
const myFoo: foo = {foo: 'foo'};
when using ts-loader with fork-ts-checker-webpack-plugin then the output is (run
npm run fork
and check dist/index.js):var foo = myNamespace.foo;
var myFoo = { foo: 'check' };
JS runtime will complain about myNamespace is undefined.
when using ts-loader without fork-ts-checker-webpack-plugin then the output is (run
npm run no-fork
and check dist/index.no-fork.js):var myFoo = { foo: 'check' };
we are heavily using namespaces & these kinds of alias imports in our project & that currently blocks us using fork-ts-checker-webpack-plugin.
it does not make any difference if an ambient or non-ambient namespace is used. (see index.ts in my example)
The text was updated successfully, but these errors were encountered: