-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Update README.md to include example of using triple-slash directive. #776
Conversation
These directives are used to instruct the compiler of various types of dependencies between files that are not otherwise obvious. By leveraging them in our code, we can manage type definitions for untyped third-party JS libraries without making our project configurations more complex.
2 similar comments
@cookrn Is there a reason you couldn't use the |
@blakeembrey great question. Basically, I was scared off by this note in docs:
We use lots of definitions from DefinitelyTyped, some libraries that include their own types, and also ad-hoc definitions in our project for untyped JS libraries. Wouldn't we lose libraries that specify their own types if we used |
@cookrn Sounds like an opportunity to fix that description too! So |
Specifically:
|
Thanks for the info @blakeembrey. I'm not following if you're hoping I can make additional changes in this PR or it should be closed? Maybe you mean the quote from the TypeScript docs could be added to the |
@cookrn Sorry, I thought the quote you used was from the README before I realized it's from TypeScript and quoted the part below it that mentions your concern. I'm happy to merge this, just don't think people should need it normally if they want to use |
@blakeembrey since the other options are preferred, what if I slim down the diff here to mention triple-slash directives as an alternative option rather than a scenario that may be required depending on your configs. Now that I understand |
@cookrn Absolutely, would love to accept whatever you feel works with 1. the preferred way in TypeScript, and 2. the best way to document how to accomplish what you need 👍 |
@blakeembrey I reduced the language a bit to still link to the official docs and call them out as an alternative. Look ok? |
These directives are used to instruct the compiler of various types of dependencies between files that are not otherwise obvious. By leveraging them in our code, we can manage type definitions for untyped third-party JS libraries without making our project configurations more complex.
I struggled for a solid day to first understand that it was
ts-node
that was unable to locate my module type definitions and then to configure my project so that it could find them when needed. Hopefully this example might save others some time!