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
[1.3] - How to prevent TypeScript from marking the meteor/PACKAGE_NAME
imports as error?
#6177
Comments
meteor/PACKAGE_NAME
imports as error with TypeScript?meteor/PACKAGE_NAME
imports as error with TypeScript?
meteor/PACKAGE_NAME
imports as error with TypeScript?meteor/PACKAGE_NAME
imports as error?
This would be awesome because I also want to use ESLint to detect incorrect imports! |
And this would also solve the same issue with Flow static type checking. Maybe a separate issue, but also absolute imports do not work for Flow. Do they work in TypeScript? |
Doesn't facebook have some weird system that prevents them from writing down the import paths at all? I always see these annotations with |
Does anyone want to build a pull request for this? |
@stubailo, I didn't know about the So fixing this for TypeScript should fix it for Flow as well. @avital, about the PR: to be honest, I have no idea where to start. P.S. I was trying out flow because it is available in the |
@avital do you want a pr updating the build tool to generate the |
What do IDEs show when people use Webpack-style requires that include non-standard characters like I personally think the answer of "just have the linter ignore those lines via whatever nolint directive" is OK As for what the pull request would look like, honestly, I don't know. |
Just a heads up for people using Flow and encountered the absolute path issue. You can add a
Now Flow understands your absolutes paths! EDIT:
If Meteor moves its packages to NPM, this will no longer be an issue, right? |
Wow this is awesome info! |
It seens that Typescript module path mapping on microsoft/TypeScript#5039
|
@bySabi will this really solve the problem for Typescript? The meteor packages do not reside in node_modules directory and they do not conain typescript definitions so nothing will be resolved. Isn't the only way to rewrite the meteor.d.ts file to contain all type declarations for meteor packages? And for other packages as well. Although paths work, following does not:
[EDIT] Modifying Meteor.d.ts does the trick and forces to correctly specify all import paths. For example, the Accounts package is wrapped into module as following:
I will be rewriting this and if anyone will be interested I can post the full .d.ts file later or even submi it to DefinitelyTyped as version 1.3. Thanks |
The initial version for Meteor 1.3 can be found here: https://gist.github.com/tomitrescak/8366ce98f1857e202ea8 |
I am not sure where Session belongs ... I think it is part of "meteor/meteor" will experiment with that later. |
@tomitrescak I don´t tested my self. Only found the PR on Typescript repo and I thoungh it could be the answer to import on meteor. Is on my schedule a In my schedule I have too a |
Well, I am successfully using the file from that gist in my Mantra application. Also, I wrote several other typings for flow-router and more. Will put it online soon. I think, @eXon is working on the webpack:typescript. |
@tomitrescak Thanks for the very helpful gist, any progress with uploading your work? Hopefully you have |
@omeid I do have a lot of the packages done, but it's all just about wrapping the existing package d.ts into extrenal module definition
I'm exploring now the amazing work of Blake Rembley https://github.com/typings/typings and am thinking of adding typings there. [EDIT] I will not be adding typings to Blake's site and I hope that meteor MDG will roll out their own set. I simply do not have the time. If anyone wants to do this I can provide latest Ambient definition for Meteor. |
The Guide's current recommendation for using TypeScript with Meteor is to use the barbatus:typescript package. See that projects README for instructions on how to install Meteor specific typings, that will address this issue. Closing - thanks! |
@hwillson, the barbatus:typescript package is no longer the recommended approach, and the original problem of auto-importing type definition files for 3rd party packages still exists. Possible dupe of #10828. Forum discussion: https://forums.meteor.com/t/atmosphere-packages-with-typescript-definitions/54292 |
Hi,
I am using 1.3-beta.8 and I try to import Atmosphere packages into my code.
So in order to import them, I use:
It works great, but there is only one thing that bugging me...
I am also use TypeScript as my compiler, and TypeScript marks that line as error, because it's an unknown import - it looks for a Node package named
meteor
inside the node_modules folder, and there is not such directory, so the IDE marks that import as error.The error appears in TypeScript compiler log as unknown import, and marked as error in the IDE (WebStorm11).
I guess that if Meteor can create a fake NPM package named
meteor
under the node_modules and create a fake definitions file under that directory, it will solve that issue.The text was updated successfully, but these errors were encountered: