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

Documentation: Outline third-party developer resources (TypeScript definitions) #15027

Closed
aduth opened this issue Apr 17, 2019 · 7 comments
Closed
Labels
[Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@aduth
Copy link
Member

aduth commented Apr 17, 2019

Previously: #14308

Related:

In the course of above-linked meetings and subsequent feedback windows, it was decided that TypeScript definitions will not be maintained in this repository at this time, due to a combination of the fact that the project is not a TypeScript project, and the concern of the maintenance overhead in assuring and implementing accurate definitions as code changes over time.

That being said, we should be mindful that these definitions could provide an improved developer experience for those who choose to implement TypeScript in their own projects. For that reason, we should be willing to assist these developers in directing them to qualified third-party resources.

Action item: Include in documentation a reference(s) to reputable and well-maintained third-party resources (projects, repositories, blog posts) which could aide a developer who might be in pursuit of or benefit from TypeScript definitions. Ideally, the resources would require minimal maintenance (i.e. would remain reputable and valid over time, so as to avoid the need to continuously reevaluate).

Possible candidates:

@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Developer Documentation Documentation for developers labels Apr 17, 2019
@Ciantic
Copy link

Ciantic commented Nov 21, 2019

could provide an improved developer experience for those who choose to implement TypeScript in their own projects

It's not just TypeScript developers. It provides much better experience for JavaScript developers too. Because editors such as VSCode can read type definitions when editing JavaScript and give errors and warnings.

Secondly having official TypeScript definitions would allow to do static analysis on existing blocks. Magnitude of WordPress user base would allow for example WordPress GUI to highlight or give warnings on incorrect usage of function etc. even for those developers who don't care.

TypeScript is not about forcing anyone else to use it, it's about providing great libraries and self documenting code for everyone.

P.S. there is no WordPress definitions in https://github.com/dsifford/academic-bloggers-toolkit/tree/master/types ?

@aduth
Copy link
Member Author

aduth commented Nov 25, 2019

@Ciantic It's my understanding that the types previously located at that link have been merged into the DefinitelyTyped repository.

Having since integrated TypeScript tooling into many of my recent JavaScript (non-TypeScript) projects, I totally agree with you that this can benefit JavaScript developers as well. And to that end, I would very much encourage that any documentation of these resources not frame it as only benefiting TypeScript projects (in contrast with remarks of my original comment).

Worth noting, this issue isn't meant to debate whether those types should exist, but rather to ensure the available options are sufficiently documented.

Separately, I'd actually be interested to revisit the topic of first-party types, though more from the angle of how we can surface good type details from our existing JSDoc, given its interoperability with TypeScript tooling (some recent related work at #17014).

@aduth aduth mentioned this issue Nov 25, 2019
6 tasks
@mikeselander
Copy link
Contributor

mikeselander commented Nov 27, 2019

Adding my support here for first-party types; the DefinitelyTyped repository is quite out of date and the rate of churn on adding new packages and moving components is way too much to keep up with as a third-party. Keeping these types internally would significantly improve developer experience.

(hopefully this is an appropriate place to flag this; sorry if it's not 😬)

@jameslnewell
Copy link
Contributor

jameslnewell commented Nov 27, 2019

With Typescript 3.7 adding support for the use of --declaration with --allowJs we could generate first-party types from JSDoc!

@ntwb
Copy link
Member

ntwb commented Nov 28, 2019

I'm also +1'ing this, adding to the #core-js agenda

@aduth
Copy link
Member Author

aduth commented Mar 19, 2020

Noting that this issue is mostly satisfied by the work in #18942, which implements both first-party types output from packages as well as relevant documentation for how TypeScript is used in the project.

The only other thing I'd consider as an optional part of the scope of this issue is to improve documentation concerning how third-party developers can best leverage those types. That said, outside of general awareness of those types existing, and assuming a developer wanting to use these types may already have some familiarity with the general process involved in using types from dependencies, there's ideally not much more to it at that point than it "just working".

@aduth
Copy link
Member Author

aduth commented Mar 27, 2020

WordPress NPM packages will now ship with first-party TypeScript types as of the changes in #18942.

@aduth aduth closed this as completed Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

5 participants