-
Notifications
You must be signed in to change notification settings - Fork 423
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
DOM Lib Generator infra thread #1023
Comments
|
re: Yeah, #997 was kinda hitting my threshold for things we should be shipping with the TypeScript compiler - it's a natural fit for separate |
Edit: Or alternatively it could be |
I was figuring Luckily all these small names don't have well used npm modules which we're not trampling on either. |
It's worth pointing out that this will be opt-in -- the DOM types will still ship with Typescript and using |
From our design meeting on Friday, I remember one issue is what DT packages like However, it's probably not a problem that needs to be solved immediately, since jsdom will continue to work with the built-in DOM types. |
BTW, I'm still not sure TS should promote such early ones in the field. There should at least be some warning that it's not well supported and the API form can still change. |
I think from our side we'll probably tell people about some of the biggies in the docs (dom/*worker/audiolet?) but change the README here to list all of them with some sort of 'and all these', so we won't be mentioning anything but the critical ones except very close to the source of truth |
So far, we have:
All linked to microsoft/TypeScript#44684 |
OK, @saschanaz has the ability to merge PRs which don't affect deployment and CI infra, and the package json. |
This looks like a huge achievement and will make things a lot easier going forward. Congratulations! Could you help me understand whether the current state already addresses readable byte streams as suggested in #890 (comment)? Is there a clean way that I can add support for readable byte streams types in my library? |
Congratulations on this huge achievement! Is this the right place to report issues? I've noticed that the
Was the removal intentional? Should they be reintroduced? |
Those are not available on any modern browser nor MDN, and thus are probably IE-specific properties. The removal is intended since the types library intends to only include things that exist in modern browsers. |
@saschanaz Thank you for your quick response and explanation! That makes sense. I was unable to find proper docs for these properties as well, except for the discontinued WebPlatform project. I guess keeping them removed is most sensible. 👍 |
Small note: it can be useful to have single |
Maybe I'm just doing it wrong, but I can't figure out a way of directly referencing individual types in the new Is there a syntax that would allow me to import a single type? If not, would you consider packaging in such a way that this becomes possible? (I can open a new issue if that helps.) |
I think a new issue will indeed be helpful 👍 |
OK, I'll file one. Funny enough, I was looking for this to solve your own problem from 5 years ago. ETA: I filed #1207. The reason it could be helpful for that TS issue (optional types) is that // @ts-ignore
import type { Element } from "web"; would resolve to the correct type when |
I'm going to close this issue as "done" (it represents the work to deploy/run/maintain the separate There are separate issues +ideas for the splitting out types but that's not what this issue represents |
We would like to stop forcing the DOM dts files from being tied directly to a version of TypeScript, making migrations easier. In addition, we would like to give @saschanaz more control on this repo (they are doing a lot of work, and we should respect that)
With some of these constraints in mind, we think we've got a few ideas which work to address these:
We treat this repo a bit like a mini-DefinitelyTyped. Giving it automation to ship packages to
@types/xyz
- specifically, today with the repo in the current state, we should be able to ship:@types/dom
,@types/dom-webworker
and@types/dom-serviceworker
. All of these@types/x
can be deployed automatically from master/main. Add the ability to upload to @types/x #1025Because all the packages can live in the same repo, that makes it possible for us to expand to
@types/dom-strict
for example which would have some of the changes which were too breaking to apply across the entire ecosystem. e.g. Replaces several DOM methods with weaker typings and closes microsoft/TypeScript#4689 #885Unsure if it's something we want to explore, but this does also open up the potential for DOM lib generator to ship types for things which may never pass our heuristics, like early-stage proposals or Chrome only APIs which come from WIDLs. Today we tell people to put those on DT. Some examples might have been
@types/dom-web-vr
(which never made it to a standard) or@types/dom-web-xr
(which is still just chrome.)We add OSS-Docs-Tools/code-owner-self-merge to the repo for @saschanaz - covering
src
,baselines
,input files
&README.md
(that seems to cover most PRs) - I'm also open to exploring something similar for issues. For repo security, we can keep the deployment infra in a separate folder and the code being shipped by default in TypeScript still need a manual PR to the TypeScript repo, where it can get audited for larger ecosystem impact there.What this means for users
With these changes you:
Because we ship the dom APIs as a default in TypeScript, you would need to set your
lib
to be something like"lib": ["es2019"]
(withes2019
being yourtarget
) instead of havinglib
missing (meaningdom
won't be added by default) and thenyarn add @types/dom
.How does this affect breaking changes?
The main dependency
libdom.d.ts
and@types/web
have the same goals of backwards compatibility as prior to this work. We don't want to use@types/web
as a way to ignore breaking changes. We already have tests that run the full TypeScript compiler test suite on every PR, and WIP for running DefinitelyTyped tests #1039 and an idea how to test against the Deno stdlib in #1027.There is sufficiently good reason to ship larger breaking changes (for example using the template literal syntax in the DOM query APIs like #885 ) and these could live inside a 2nd DOM deploy.
How does this affect the security of
@types
?Deploys are npm packages which are auto-generated from
.d.ts
files, which this repo creates. Any changes to the build and deploy infra require a TypeScript admin to accept the PRs.What is a release?
As
@types/web
is released on every commit, eventually a specific version of thed.ts
files in@types/web
make their way into TypeScript. We can note the version of@types/web
which corresponds to a specific release in TypeScript in the release notes, and in a table in the repo README here.Backwards compatability
So far, I've stated that 4.4 is the minimum version of TypeScript which supports
@types/web
in part because I'm hoping to get the support for switching dom with@types/web
in natively then. We can start a similar 2 year window to DT if we want, using downlevel-dts to support older syntax if needed.The text was updated successfully, but these errors were encountered: