This repository has been archived by the owner. It is now read-only.

References stripped #227

Closed
johnnyreilly opened this Issue Feb 19, 2016 · 26 comments

Comments

Projects
None yet
9 participants
@johnnyreilly
Copy link
Member

johnnyreilly commented Feb 19, 2016

I suspect this may be a flaw in the definition on DT but I just wanted to share my odd experience using Typings to install moment. I did this:

PS C:\Source\TheProj> typings install moment --ambient --save
? Found moment typings for DefinitelyTyped. Continue? Yes
Installing moment@~2.8.0 (DefinitelyTyped)...

References (stripped):
  github:DefinitelyTyped/DefinitelyTyped/moment/moment-node.d.ts#b090bcf9ba9f756ec8ff53e7707269729172a325 (from moment)

moment
└── (No dependencies)

Which gave me this:

// Compiled using typings@0.6.8
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b090bcf9ba9f756ec8ff53e7707269729172a325/moment/moment.d.ts
// Type definitions for Moment.js 2.8.0
// Project: https://github.com/timrwood/moment
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
// Definitions: https://github.com/borisyankov/DefinitelyTyped


declare var moment: moment.MomentStatic;

So to actually get something working I had to then typings install moment-node --ambient --save.

I guess it gave me the hint when it said:

References (stripped):
  github:DefinitelyTyped/DefinitelyTyped/moment/moment-node.d.ts#b090bcf9ba9f756ec8ff53e7707269729172a325 (from moment)

I can see the docs mention this but I wonder if it might be worth augmenting the wording for the "References (stripped):" to indicate that the user may need to subsequently install the stripped references somehow.

Thoughts?

Also, presumably this is only an issue for the ambient use case?

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Feb 19, 2016

Also, presumably this is only an issue for the ambient use case?

Yes.

Thoughts?

Definitely need to improve wording. Open to any suggestions.

@johnnyreilly

This comment has been minimized.

Copy link
Member Author

johnnyreilly commented Feb 19, 2016

Cool - will have a ponder.

@leonyu

This comment has been minimized.

Copy link

leonyu commented Feb 20, 2016

From a UX standpoint, this gets ridiculous for some projects:

$ typings install cordova --save --ambient
? Found cordova typings for DefinitelyTyped. Continue? Yes
Installing cordova@~* (DefinitelyTyped)...

References (stripped):
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/BatteryStatus.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Camera.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Contacts.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Device.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/DeviceMotion.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/DeviceOrientation.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Dialogs.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/FileSystem.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/FileTransfer.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Globalization.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/InAppBrowser.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Media.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/MediaCapture.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/NetworkInformation.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Push.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Splashscreen.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/StatusBar.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Vibration.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/WebSQL.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Keyboard.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)

cordova
└── (No dependencies)

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Feb 21, 2016

@leonyu A reasonable way to fix this is by using typings.json to specify the dependencies declaratively. It's just not easy to decide whether Typings should install those or not, so I opted to not and allow people to write actual typings using external modules that do work.

@kdawg1406

This comment has been minimized.

Copy link

kdawg1406 commented Feb 22, 2016

This is a real PIA and will waste time and frustrate developers.

tsd install angular --save This command brought in the required dependencies. e.g. jQuery
**
typings install angular -S -A ** This command does not install jQuery and does not list the required dependency.

Forgive me, but forcing developers to upgrade from tsd to typings, when typings its not ready and does not offer compatible CLI usage, is not good.

Compatible CLI should be a P0. You already make us add -A to get to type definitions we have been using for years, now when they are added to the project, the dependencies are not added. Worse first time downloader of a type definition will never understand why they can't compile. Now they have to waste time figuring out what is missing.

When a developer uses -A or --ambient, the CLI should behave exactly like tsd and bring in the dependencies.

Karl

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Feb 22, 2016

@kdawg1406 Please read the comment above, but it won't be happening by default. You're welcome to continue using TSD, I haven't forced anyone to move but it's good to let everyone know that it's unmaintained. In fact, I asked if anyone else wanted to pick up maintaining it (DefinitelyTyped/tsd#269) - it take a lot of time to respond to things like this, especially when it's a project in addition to a full time job. I've gone over this a dozen times now, but the references are not a way to specify dependencies.

If you want this to work for your projects, consider contributing to Typings. It's not too hard (I hope) to help contribute. I will also accept a PR for a --follow-references flag for install.

@kdawg1406

This comment has been minimized.

Copy link

kdawg1406 commented Feb 23, 2016

Thank you for responding so fast.

I think I've posted on the wrong thread.

My example, there are no stripped references listed by the CLI.

My example are actual real dependencies that are not getting installed; no messages either.

Are you saying that typings will not install real dependencies like jQuery for angular?

BTW: Why hasn't Microsoft stepped up to fund this project? TypeScript depends on tsd OR typings, correct?

Karl

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Feb 23, 2016

My example, there are no stripped references listed by the CLI.

Oh, that certainly sounds like a bug. Definitely feel free to create a new issue, I'd love to be able to replicate it.

My example are actual real dependencies that are not getting installed; no messages either.

Can you point me to what you're installing? I haven't seen this issue. Just remember that sub-dependencies are namespaced, they aren't automatically dependencies of your own project.

BTW: Why hasn't Microsoft stepped up to fund this project? TypeScript depends on tsd OR typings, correct?

Not for me to answer, but TypeScript has a lot going on themselves and we do collaborate a little (there's some discussion with them around #223). TypeScript does not directly depend on TSD or Typings, it's just a PITA to use TypeScript without either of them (actually, they are using TSD recently for their Salsa project, but that's something else).

Edit: Here's what happens when I install angular typings from DefinitelyTyped:

image

Edit 2: Also, I am sorry it's a PITA in the interim for currently ambient definitions. However, it'll be worth it in the end, promise 🙏 Can't use TypeScript long-term with everything being ambient and zero distinction between dependency types.

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Feb 23, 2016

What about?

Installing angular@~* (DefinitelyTyped)...

References (stripped):
  github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#1c4a34873c9e70cce86edd0e61c559e43dfa5f75 (from angular)

To install a stripped reference:

  typings install "<location>" --ambient

angular
└── (No dependencies)

Or, we can print each line with the full command and grey out the command parts leaving the actual location bolded a little. Then it's just copy and paste to install everything.

References (stripped during installation):

typings install 'github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#1c4a34873c9e70cce86edd0e61c559e43dfa5f75' --save --ambient

P.S. The flags in the printed command should be the same as the user just used. If they installed with ambient, enable ambient. Same with save or save dev.

@blakeembrey blakeembrey added this to the 0.7 milestone Feb 23, 2016

@kdawg1406

This comment has been minimized.

Copy link

kdawg1406 commented Feb 23, 2016

Totally my bad. I just created a fresh directory and got the same results you did. Not sure why that didn't happen the first time I ran it.

Yes, I like your idea of printing the install command line.

Thank you for the very hard work.

Karl

@johnnyreilly

This comment has been minimized.

Copy link
Member Author

johnnyreilly commented Feb 27, 2016

Sounds good - maybe I'll take a look

@leonyu

This comment has been minimized.

Copy link

leonyu commented Feb 27, 2016

I like it 👍

@johnnyreilly

This comment has been minimized.

Copy link
Member Author

johnnyreilly commented Feb 27, 2016

Raised a PR for this.

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Mar 2, 2016

Closing as the PR is merged.

@Zorgatone

This comment has been minimized.

Copy link

Zorgatone commented Apr 20, 2016

@blakeembrey maybe I missed something. How do you install the dependencies now?
Do I still need to download each of them manually (DT ambient)?

I'm still getting the same thing (using typings v0.8.1):

$ typings install --save --ambient ionic
typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular.d.ts" during installation from "ionic"
ionic
└── (No dependencies)
@unional

This comment has been minimized.

Copy link
Member

unional commented Apr 20, 2016

For ambient, yes

@shyamal890

This comment has been minimized.

Copy link

shyamal890 commented Apr 23, 2016

@blakeembrey I thought --follow-references would install the dependencies but it doesn't. So is there a way I can install all the stripped dependencies?

Because to install all of these stripped dependencies manually takes a lot of time.

$ typings install cordova --save --ambient
? Found cordova typings for DefinitelyTyped. Continue? Yes
Installing cordova@~* (DefinitelyTyped)...

References (stripped):
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/BatteryStatus.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Camera.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Contacts.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Device.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/DeviceMotion.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/DeviceOrientation.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Dialogs.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/FileSystem.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/FileTransfer.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Globalization.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/InAppBrowser.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Media.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/MediaCapture.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/NetworkInformation.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Push.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Splashscreen.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/StatusBar.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Vibration.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/WebSQL.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)
  github:DefinitelyTyped/DefinitelyTyped/cordova/plugins/Keyboard.d.ts#ac7f83bdcf1dfd70e70acf7a87cf8e83719dacd6 (from cordova)

cordova
└── (No dependencies)

For people searching how to download stripped dependencies manually:
typings install cordova/plugins/keyboard --ambient --save . Do note lowercase.

@Zorgatone

This comment has been minimized.

Copy link

Zorgatone commented Apr 23, 2016

I asked because I had the same issue

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Apr 23, 2016

@shyamal890 There is no such thing as a --follow-references flag. No, there's no way to do it unless you want to make a PR enabling it.

@xavdid

This comment has been minimized.

Copy link

xavdid commented May 31, 2016

@blakeembrey is this functionality gone?

I'm using typings v1.0.4 and while it tells me what references were stripped, it's hard to grok.

% typings i dt~angular -SG
typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b76dd8a7f95b71696982befbb7589940d27e940b/jquery/jquery.d.ts" during installation from "angular" (main)
angular
└── (No dependencies)

You have to go all the way to the end of the long url to see jquery.d.ts. A set of either urls or even just names would be great.

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented May 31, 2016

Yes, it's been missing in that form since 0.8. There's no such thing as names, so that isn't really possible. You're welcome to submit a PR to restore the resolved Typings names - but there's a reason why it was removed which I'm currently forgetting.

@xavdid

This comment has been minimized.

Copy link

xavdid commented May 31, 2016

Happy to make the PR, but if there's a reason it was removed is it worth putting it back in?

@johnnyreilly

This comment has been minimized.

Copy link
Member Author

johnnyreilly commented May 31, 2016

+1 from me in the absence of a reason why not

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented May 31, 2016

@xavdid It was a technical limitation I run into when making changes. It should definitely be corrected, if it's easy enough. I just can't recall the limitation right now and won't have time to check it for a while.

@mikekidder

This comment has been minimized.

Copy link

mikekidder commented Jun 18, 2016

Wanted to add a note on Typings and stripped references. Was just working on typings because @types/ still not pulling DT packages correctly.

typings install dt~react-router --global --save stripped out a local reference:
/// <reference path="./history.d.ts"/>
which is different file then when you install:

typings install dt~history --global -save

So you end up basically resorting to fixing things by hand....

@blakeembrey

This comment has been minimized.

Copy link
Member

blakeembrey commented Jun 19, 2016

@mikekidder Yes, you end up having to understand the internal DefinitelyTyped structure because there's no dependency system implemented. For reference, you can install using dt~react-router/history.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.