-
Notifications
You must be signed in to change notification settings - Fork 262
What about "The Future of Declaration Files" #600
Comments
What sort of thoughts are you after? I'm positive on it (as it says, I've been helping out) but there's still a few kinks that need ironing out and some work to put into it. |
What should I be doing today when I write new .d.ts files? Put them in DefinitelyTyped, or typings' registry, or both? I like the distributed nature of typings' registry, and how it differentiates between external and ambient modules, and is agnostic to the exact name of a module. How will those things be possible when everything's in DefinitelyTyped? How will DefinitelyTyped deal with different versions of a declaration? Are there any github issues or blog posts I can read to answer these questions for myself? |
@cspotcode You're better asking these questions in the linked TypeScript repo discussion. Today, you can put them where you like. I'd recommend still using Typings until we get redirects working and then we'll put an effort in to port the existing registry base into DefinitelyTyped. The big thing why is also external modules for me, I haven't yet seen the huge refactor of DefinitelyTyped which should refactor the repo into external modules (but it's coming). |
External vs ambient should be less of an issue, since UMD support is coming in TypeScript 2.0 also. The only other concern is namespace conflicts, which I believe NPM module will take precedence since it's now going to be mirrored to NPM.
As far as I can tell, inside the repo it'll be versioned folder based. Across redirects has not been defined.
There's a few, the best ones to start with are the official one: microsoft/TypeScript#9184. |
@blakeembrey Thanks, I missed that link in the blog post; I'm checking it out now. UMD sounds great, plus the planned ability to reference external repos from DefinitelyTyped. It sounds like a lot of the advantages of typings are being brought into DefinitelyTyped and the TypeScript compiler itself. The huge refactor of DefinitelyTyped to external modules: will that be something the TS team automates, e.g. converting everything to a UMD declaration? |
As far as I know, yes. |
@blakeembrey Lol. I am not "after" any specific thoughts. It was my way of trying to nicely ask if typings will cease to be, and we should start migrating towards this new "Future"... |
@zam6ak Easier to just ask, I won't take it too personally 😄 Yes, we should migrate. No, Typings won't cease to exist until traffic drops well off the block (I won't be killing something people use). No, we can't migrate until the infrastructure set-up is completed. |
@blakeembrey Ok great. Thanks for the clarification. May be useful for others to put some of those points on the from page of the project. |
|
I am having so much trouble with this. I submitted a repo to DefinitelyTyped, which is now ported to @types. It seems like a better idea to distribute the file on npm along with source code to minimize install steps. But the two files conflict with each other. It would be really helpful to have more thorough instructions on how to create definition files with tests that assert the APIs in those definitions. I really want the development experience with TypeScript to be awesome, but it has been nothing but pain all the way down. I should add that our library exposes one global for test integrations. |
@marcysutton I think what TS will need to do in the future is resolve typings like Node resolve dependencies. Don't treat them globally, but only external, and look in node_modules subfolder of the typing first, then go one dir up, repeat. But that is not possible currently, the only system that manages typings dependencies properly is |
@felixfbecker TypeScript 2.0 does that with @types and |
If that is the case, what is the cause of your issue then? |
AFAIK, TypeScript 2.0 solution does not handle version dependencies properly. Simply because in the declaration file you cannot specify which version of the dependencies you are depending on. |
@unional it would be alright if they resolved the deps like Node:
But all you get at the moment is |
yes, that is an issue they need to solve to properly handle versioning. btw, your illustration clearly describes the problem. GJ 🌷 |
Another btw, would this also get into trouble? |-- index.ts // will get declarations for A@1.0 and B@1.0
`-- node_modules
`-- @types
|-- A@1.0 // will get declarations for B@1.0
| `-- node_modules
| `-- @types
| `-- B@1.0
`-- B@1.0 // Still 1.0 I didn't try it out because I know the version issue is not resolved. |
I haven't been using TS 2.0 module resolution myself yet, just because Typings does work perfectly fine for myself, but I thought TypeScript had fixed the issues around dependency resolution. At least, this was 100% my concern so if it hasn't been resolved that'll be a huge bummer. My understanding was external modules act like they do in Typings (following If someone can confirm this isn't the case, it should be a logged issue ASAP. As for the initial comment a couple of hours ago, @marcysutton can you give more information on what you're doing or trying to do so someone can help? |
@blakeembrey I agree, I am using typings atm too until the redirects are implemented, so my statement might not be true anymore. |
No issue, just wanted to get peoples toughts on this
The Future of Declaration Files
https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/
The text was updated successfully, but these errors were encountered: