-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
TypeScript typings, the TypeScript compiler, and jspm packages #1344
Comments
We can certainly look at ways of aligning with these workflows, but I don't believe we do currently. @frankwallis I'd value your input here. Would it help to do any conversion of this pattern on install in the jspm npm registry endpoint implementation? |
As far as allowing tsc or your IDE to resolve these typings from within jspm_packages then I believe this will be possible after the implementation of this issue and this has also been raised here When type-checking within SystemJS, I have tried to implement a solution for loading the typings field (see here), but it involves fetching package.json and then pulling out the value, which is not ideal (and I know it fails sometimes - e.g. when there is no package.json) If you are suggesting that the typings configuration could be made available in the package configuration at runtime, then that would be a big help for me. Also, sometimes packages will omit this field and put their typings in a file named 'index.d.ts' where the compiler is expected to look for it. When loading from the browser searching the file-system is not possible (AFAIK), so if it was possible to override the typings configuration in the jspm registry then that would also be very useful. EDIT: Things may also get easier after the implementation of this project: https://github.com/typings/typings |
@frankwallis if there was support for say |
@frankwallis - the interesting thing with the |
@guybedford - it would help somewhat, but I don't think it would be enough. The problem is that the The TypeScript compiler can easily search the file-system to look for the files, but when trying to compile from the browser this makes it extremely difficult to resolve them without a pre-created map of module -> typings file. I am hoping that the typings file will eventually provide (or enable the creation of) a map which I can use to resolve the typings file for each module. In the worst case I may have to deprecate type-checking in the browser - which would be a shame as it is a nice feature for small projects. I am holding off for the time being to see how things progress. |
@frankwallis thanks for the update. Yes that is not ideal. Surely there is a standard convention though of where to locate it within a single package, just like the |
I have raised an issue to look into typings integration: typings/typings#123 |
Ok, I'll follow that. Please copy me in as you see appropriate on this. |
Could this be reopened please? As it stands I'm going to have to using |
@MeirionHughes I currently do something like this to make WebStorm happy. I mirror my jspm packages as npm dev-dependencies to eliminate any problems (like code completion). It is a hassle, but it's the best solution I have found. |
The Aurelia team has resurrected this a few times. Keeping the tradition alive. I'm still a huge proponent of jspm, as I find the advantages outweigh the benefits of any other loader. I'm building a new project and I'd love to see TypeScript as a first class citizen. It seems like it would just be a matter of inspecting the package.json and pulling in the typings file where specified. TypeScript compiler can take it from there. See here: https://github.com/aurelia/framework/blob/master/package.json#L17 |
@davismj I fully agree. JSPM and TypeScript are my go to tools for any client side project. However, this issue is not having JSPM resolve and install the declaration file dependencies. I believe that this would be fairly straightforward. The problem is that TypeScript is deeply coupled to and reliant on mimicking the behavior of the NodeJS require function. It works with Aurelia's Typings distributions because they are ambient, contributing to a global ambient module namespace. One of the key benefits of jspm is multi-versioning. Personally, I also value explicit and matching versioning as well. Since TypeScript does not traverse JSPM's config file, it does not resolve non-ambient modules, which are the primary kinds of typings distributed currently on npm, and have the benefit of not colliding in an ambient global namespace, they can be side by side versioned. Because I wanted exact versions of Aurelia dependencies for my projects, and because I wanted to get the developer experience from the old Aurelia beta that shipped with It is a complete hack, it is not well designed, but I think it conveys certain difficulties, https://github.com/aluanhaddad/aurelia-types-installer, it is linked purely for illustrative purposes. That said, we really should resolve this friction. |
TypeScript - Typings for npm packages
finally, the package install for npm can alert the typescript compiler to the location of the package's
.d.ts
files.will this work when using jspm to install a package?
The text was updated successfully, but these errors were encountered: