-
Notifications
You must be signed in to change notification settings - Fork 122
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
Upgrades to TypeScript 1.3. Fixes Bug 187. #198
Conversation
In hindsight, I might just check in the javascript files, or update the npm (or grunt) build to run that first. Build seems to fail if I don't. Up to you guys. |
Looks like @sebas2day had the same idea with #197. I would still recommend an upgrade to TS 1.3 though. |
Since 1.4 is out, looks like you guys are upgrading that way. I'll go ahead and close this. |
Hey there @mtraynham - thanks for the pull request. I am very sorry that I just didn't have the time to look it over in the past month or so. |
Hey @nycdotnet. Quite alright, I've been using my fork for the most part, so no issue there. I saw that you guy's were planning an upgrade to 1.4, but I also noticed something weirdly wrong with my pull request. So I decided to close this out and revert back to 2.0.1. Unfortunately it doesn't totally work for me either. Personally, I'm going to chalk this up to my own confusion. Maybe you can help me though... I'm working on a library project which is split across multiple files. What is the proper way to The example below shows what I mean. When developing ambient external modules, a "file" module can be represented as a class using the After I made my change, things started compiling better downstream... But i'm not entirely sure that path is correct either. So maybe you can give me some direction. As an example: a.ts:
Standard version:index.ts:
index.d.ts:
Grunt-ts versionindex.ts
index.d.ts
Output of dts-bundleStandard versionindex.d.ts
Grunt-ts version:index.d.ts
|
You're not confused - or at least you are confused, but you're in good company. This is one of the major outstanding pain points with TypeScript since pretty much day 1. I must be honest that I have not yet seen a good way to do multi-file libraries in TypeScript when using external modules that allows a separate project (such as a UI) to use the typing from the library in an effortless manner. I would love to be wrong. I see that you already posted here microsoft/TypeScript#17 (notice the low issue number). Another good thread is here: microsoft/TypeScript#1753 . I've been lucky enough to be able to avoid external modules altogether and just use TypeScript internal modules for the browser-based projects I work on. When considering the performance drawbacks of issuing many HTTP requests, a large minified JS file that exposes only a single global variable is often the best solution. I do have an idea to upgrade grunt-ts to be able to generate UMD files from internal modules, but that's for another day. |
:P I have to say, I think I've tried 14 different ways to do things, always looking for the best one (tutorials are slim to none). Sometimes I turn up empty-handed, sometimes not, but my hopes are still pretty high. I think I might be on to one thing though, which the author of https://github.com/SitePen/dts-generator alluded to. Maybe the single point of entry should be avoided for multi-file libraries. Instead of requiring the main module, you just require by path and avoid the large list of If I don't come up empty-handed, I'll be sure to drop a note somewhere. This PR though, I'd say overlook it. UMD files from internal modules :) Interesting. Thanks for the feedback and hope the 1.4.x efforts go well, should be a good upgrade! |
Thanks very much. If you figure out a good way to do it, please do let me know. I'll scream it from the mountaintops. |
In lieu of microsoft/TypeScript#512, this upgrades to TypeScript 1.3. Seems there were pretty minimal changes (lot of white space removed) to the transpiled code.
One thing to point out. I didn't check in the
tasks/**/*.js
files. I figured those were generated, and can I recommend you just add those as a build step before testing, removing them from the source tree. They can be regenerated bygrunt build
, but I think I'm preaching to the choir.I did however check in the
tests/{transform,simple}/**/*.ts
files, but I would recommend those be removed from the source tree as well.This should also be a fix for Bug #187. Using the old method of:
causes definition file import issues in dependent modules, especially when using Classes as parameter types. Note, the example below also used
dts-bundle
: