DefinitelyTyped 2.0 #738
Comments
Thanks for clarifying! |
I have a problem which I believe is related to this... https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/js-yaml These install only as a module, but looking at their code it seems they are designed as global, at least that's what I take from looking into them and from typescript error message:
So, my question is: is this a DT bug, where those definitions should have been updated, or a typings limitation? Is there a way to force a module to install as |
@jcristovao |
Yeah, I had a fork of DefinitelyTyped and solved the immediate problem (thanks!), but I am still interested on how I should proceed in cases like this in a general way - besides grabbing old versions... |
Sadly |
Ok, thanks for the clarification! Now, I understand this is more a question for DT than here, but perhaps you can clarify - was the intend of that 2.0 branch to move every typing definition to external modules? Does it make sense / is it encouraged to raise issues or PRs there for it? |
Yes, definitely. Just as Typings was written because external modules are the obvious choice when dealing with the dependency problem (to avoid conflicts), TypeScript uses the same pattern. Unfortunately, when Typings was written there was no precedent or traction for the change, but now with native TypeScript support things will continue to move to external modules for all the original reasons Typings used them.
To move a module to an external module? Yes, definitely do! I'm really hoping we'll land microsoft/types-publisher#4 in the near future so the Typings registry can start syncing to DefinitelyTyped. |
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/js-yaml These install only as a module, why is it installed as a module? it doesnt have export at the top |
It does. At the bottom. 🌷 |
most libraries today are defined in |
@blakeembrey @unional Shell I ask the author of I checked it up again and it seems to me a valid external module written in the new types-2.0 syntax. |
Yes, correct. Unfortunately, due to how If you want to use the library in script tag, and use typings through |
Currently, IMO, there are a few cases you still need to use For example,
|
Can someone please help? I'm hitting the issue of export as namespace with the 'Q' library on DT. Seems like typings is wrapping it in a module, causing tsc to error. I can't seem to be able to make it global since typings is not allowing it. In the meantime, I've forked the repo and removed that line in my fork, and using it as my definition which works fine for now. |
I'm running into the same issue as jcristovao - however, the issue is for dt~react, which I cannot resolve by installing globally. In particular, it fails on the following line in the typings file:
With the error:
I don't completely follow what the change is to exporting and why typings cannot support The files are correctly compiled, though the error is generated. Removing the line works fine (note this also occurs in |
If I understand correctly, Typings with
|
@unional That worked perfectly - thank you very much! I didn't know those packages existed |
- Bumps all NPM dependencies - Bumps typings files where possible - Moves typings to direct includes where needed (typings/typings#738) - Updates (now-generic) `React.SyntheticEvent`
- Bumps all NPM dependencies - Bumps typings files where possible - Moves typings to direct includes where needed (typings/typings#738) - Updates (now-generic) `React.SyntheticEvent`
…not work with newer declarations: typings/typings#738
…ikaday to dependencies for support in external projects (typings/typings#738 (comment))
Cross-post of DefinitelyTyped/DefinitelyTyped#13280. What this means for Typings users:
<reference>
tags. Effectively, if you're using Typings, you may not need--global
in some places anymore.tsconfig.json
typeRoots
to get<reference type>
instances to work properly (e.g.typeRoots: [typings/global]
).export as namespace
as it requires native compiler support to resolve modules - while Typings uses a legacy workaround of declaring global modules for you.There will be no disruption of existing modules using Typings as everything is keyed to a commit. If you're a new user or don't understand the implications, it's probably best to use
@types
on NPM and wait for microsoft/types-publisher#4.The text was updated successfully, but these errors were encountered: