Skip to content
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

Doc Error - Worse than no Doc: JQuery Import Fails using ES6 #20266

Closed
laultman opened this issue Nov 25, 2017 · 5 comments
Closed

Doc Error - Worse than no Doc: JQuery Import Fails using ES6 #20266

laultman opened this issue Nov 25, 2017 · 5 comments
Labels
Docs The issue relates to how you learn TypeScript

Comments

@laultman
Copy link

The documentation specifically references the JQuery import using the current ES6 syntax which does not work.
From this page: https://www.typescriptlang.org/docs/handbook/modules.html we read...
Default exports
Each module can optionally export a default export. Default exports are marked with the keyword default; and there can only be one default export per module. default exports are imported using a different import form.
default exports are really handy. For instance, a library like JQuery might have a default export of jQuery or $, which we’d probably also import under the name $ or jQuery.

From the above, I like other readers would suppose the JQuery does in fact have a "default". It does not as Visual Studio/Resharper clearly report.
After many hours over two days of searching I found this comment by Anders Hejlsberg from March 2015.
#2242 (comment) which explicitly states the correct usage. @ahejlsberg
Correct documentation is critical. Incorrect documentation costs companies lots of money and devalues the product.
Thank you in advance for making the corrections.
-Larry

@mhegazy
Copy link
Contributor

mhegazy commented Nov 27, 2017

The module is defined in JQuery.d.ts a few lines below, and it does have a default. I am fine changing the name of the module to something else less specific to avoid the confusion.
A PR is welcomed. the sources of the handbook can be found at https://github.com/Microsoft/TypeScript-Handbook. This specific file is at https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Modules.md

@mhegazy mhegazy added the Docs The issue relates to how you learn TypeScript label Nov 27, 2017
@laultman
Copy link
Author

laultman commented Nov 30, 2017 via email

@yortus
Copy link
Contributor

yortus commented Nov 30, 2017

There are some tutorials in the handbook - maybe this one would help you?

@laultman
Copy link
Author

laultman commented Dec 1, 2017 via email

@RyanCavanaugh
Copy link
Member

The handbook has been rewritten, so this is moot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs The issue relates to how you learn TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants