TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Tool for generating dom related TypeScript and JavaScript library files

Results 220 TypeScript-DOM-lib-generator issues
Sort by recently updated
recently updated
newest added

Simplify / fix HTMLCollection overrides

[{"_id":"635adc643056137e265f5bca","body":"I came across this while implementing #222, but decided it's worthwile to separate out this refactoring into its own PR as it's not strictly related to that issue.","issue_id":1661112978098,"origin_id":567170621,"user_origin_id":557590,"create_time":1576696433,"update_time":1576696433,"id":1666899044990,"updated_at":"2022-10-27T19:30:44.990000Z","created_at":"2022-10-27T19:30:44.990000Z"},{"_id":"635adc643056137e265f5bcb","body":"Revisiting this after 2 years... \ud83d\ude05\r\n\r\nNow that I have a permission to merge, I find this beneficial with no regression. Could you try rebasing? I can cherry-pick this PR if you are too busy. Thank you!","issue_id":1661112978098,"origin_id":991667062,"user_origin_id":3396686,"create_time":1639233636,"update_time":1639233636,"id":1666899044995,"updated_at":"2022-10-27T19:30:44.995000Z","created_at":"2022-10-27T19:30:44.995000Z"},{"_id":"635adc653056137e265f5bcc","body":"Lol it's been a while, yeah \ud83d\ude05 If you could rebase on your side, that would be great, yeah. ","issue_id":1661112978098,"origin_id":991729582,"user_origin_id":557590,"create_time":1639245300,"update_time":1639245300,"id":1666899045001,"updated_at":"2022-10-27T19:30:45.000000Z","created_at":"2022-10-27T19:30:45.000000Z"}] comment

Use an extra optional type param on HTMLCollection for `namedItem` override. This simplifies / removes quite a lot of emitter code that was necessary to maintain just for this override....

Emit modular.generated.d.ts

[{"_id":"635ad598ea01ec786e7ce16b","body":"Thanks for the PR!\n\nThis section of the codebase is owned by @saschanaz - if they write a comment saying \"LGTM\" then it will be merged.\n<!-- Message About Merging -->","issue_id":1661112978102,"origin_id":991675120,"user_origin_id":41898282,"create_time":1639235107,"update_time":1639235107,"id":1666897304536,"updated_at":"2022-10-27T19:01:44.536000Z","created_at":"2022-10-27T19:01:44.536000Z"}] comment

This is a draft for #1207. Another way would be to create a package that can be used as a build dependency, so that other packages can generate their own...

Certain types such as MouseEvent.button not defined

[{"_id":"635adb043056137e265f5af7","body":"My lib.dom.d.ts from ts4.5 has this in Line 12056:\r\n\r\n````ts\r\n\/** Events that occur due to the user interacting with a pointing device (such as a mouse). Common events using this interface include click, dblclick, mouseup, mousedown. *\/\r\ninterface MouseEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly button: number;\r\n````\r\nOr do you want to have this?\r\n```ts\r\nreadonly button: 0|1|2|3|4;\r\n```","issue_id":1661112978105,"origin_id":987626609,"user_origin_id":2410353,"create_time":1638860426,"update_time":1638860426,"id":1666898692025,"updated_at":"2022-10-27T19:24:52.025000Z","created_at":"2022-10-27T19:24:52.025000Z"},{"_id":"635adb043056137e265f5af8","body":"Since the spec defines meaning for the values I was looking for something more like:\r\n\r\n```\r\ndeclare const BUTTON_MAIN: 0;\r\ndeclare const BUTTON_MIDDLE: 1;\r\ndeclare const BUTTON_RIGHT: 2;\r\n...\r\n```","issue_id":1661112978105,"origin_id":988187693,"user_origin_id":26070760,"create_time":1638903443,"update_time":1638903443,"id":1666898692029,"updated_at":"2022-10-27T19:24:52.029000Z","created_at":"2022-10-27T19:24:52.029000Z"},{"_id":"635adb043056137e265f5af9","body":"They are not defined in the browsers (others like `WebSocket.CLOSED` are). \r\nSo defining them would be an TypeScript only invention. I don't think this would align to the mission of TypeScript.","issue_id":1661112978105,"origin_id":988206720,"user_origin_id":2410353,"create_time":1638905321,"update_time":1638905321,"id":1666898692032,"updated_at":"2022-10-27T19:24:52.032000Z","created_at":"2022-10-27T19:24:52.032000Z"},{"_id":"635adb043056137e265f5afa","body":"I think this is well answered \ud83d\udc4d\r\n\r\n@github-actions close ","issue_id":1661112978105,"origin_id":1250261685,"user_origin_id":3396686,"create_time":1663504633,"update_time":1663504633,"id":1666898692036,"updated_at":"2022-10-27T19:24:52.036000Z","created_at":"2022-10-27T19:24:52.036000Z"},{"_id":"635adb043056137e265f5afb","body":"Closing because @saschanaz is one of the code-owners of this repository.","issue_id":1661112978105,"origin_id":1250261741,"user_origin_id":41898282,"create_time":1663504649,"update_time":1663504649,"id":1666898692040,"updated_at":"2022-10-27T19:24:52.040000Z","created_at":"2022-10-27T19:24:52.040000Z"}] comment

I noticed some values for types such as `MouseEvent.button` are [defined in Web API specs](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button) but are not defined in `lib.dom.ts`: ``` 0: Main button pressed, usually the left button...

Types for CSS painting API - `registerPaint`

[{"_id":"635ae283ea01ec786e7cebe5","body":"[microsoft\/TypeScript-DOM-lib-generator](https:\/\/github.com\/microsoft\/TypeScript-DOM-lib-generator) is the right repository for DOM related type declarations. I haven't found an issue related CSS painting.","issue_id":1661112978109,"origin_id":957788457,"user_origin_id":5269069,"create_time":1635865908,"update_time":1635865933,"id":1666900611968,"updated_at":"2022-10-27T19:56:51.967000Z","created_at":"2022-10-27T19:56:51.967000Z"},{"_id":"635ae283ea01ec786e7cebe6","body":"Just noting for others that this looks to be a chromium only API, so you'd need to either submit the extension to DefinitelyTyped or persuade other browsers to support the API.","issue_id":1661112978109,"origin_id":986836724,"user_origin_id":49038,"create_time":1638801531,"update_time":1638801531,"id":1666900611972,"updated_at":"2022-10-27T19:56:51.971000Z","created_at":"2022-10-27T19:56:51.971000Z"}] comment

# Suggestion ## 🔍 Search Terms registerPaint, CSS paint API, types ## ✅ Viability Checklist My suggestion meets these guidelines: * [x] This wouldn't be a breaking change in existing...

Waiting on standards

fix: Mark `prototype` property of constructors as `readonly`

[{"_id":"635ae377cecf4e081a21a910","body":"We think this is probably a bit too big of a change for its value, I agree that it better reflects reality (example below) but it's hard to gauge a potential breaks from something like this.\r\n\r\n```\r\nAbortController.prototype = () => {}\r\n> () => {}\r\n\r\nnew AbortController()\r\n> AbortController\u00a0{signal: AbortSignal}\r\n\r\nconst a = new AbortController()\r\nundefined\r\n\r\na\r\n> AbortController { \r\n signal: AbortSignal {aborted: false, onabort: null} \r\n __proto__: AbortController\r\n}\r\n```","issue_id":1661112978113,"origin_id":784333153,"user_origin_id":49038,"create_time":1614098103,"update_time":1614098117,"id":1666900855995,"updated_at":"2022-10-27T20:00:55.995000Z","created_at":"2022-10-27T20:00:55.995000Z"},{"_id":"635ae377cecf4e081a21a911","body":"> We think this is probably a bit too big of a change for its value, I agree that it better reflects reality (example below) but it's hard to gauge a potential breaks from something like this.\r\n\r\nI'm not sure I understand the reasoning here, your example looks like it will benefit from `readonly`? The reason it's silently ignoring reassignation of `.prototype` is because it's not in strict mode.\r\n\r\n```\r\n\"use strict\"; AbortController.prototype = () => {}\r\n> Uncaught TypeError: \"prototype\" is read-only","issue_id":1661112978113,"origin_id":986027433,"user_origin_id":3396686,"create_time":1638624498,"update_time":1638624498,"id":1666900856000,"updated_at":"2022-10-27T20:00:56.000000Z","created_at":"2022-10-27T20:00:56.000000Z"},{"_id":"635ae378cecf4e081a21a912","body":"(But I guess some polyfill can legally assign things to `.prototype`)","issue_id":1661112978113,"origin_id":986027682,"user_origin_id":3396686,"create_time":1638624615,"update_time":1638624615,"id":1666900856012,"updated_at":"2022-10-27T20:00:56.012000Z","created_at":"2022-10-27T20:00:56.012000Z"}] comment

This more closely matches runtime behaviour. --- It also causes code that would try to re‑assign the `prototype` property of **WebIDL** constructors to have the error caught at compile time,...

Probably won't take

![Screenshot 2021-12-03 12 52 13](https://user-images.githubusercontent.com/6358971/144598324-766eb10c-a524-4f02-8ceb-d9d4fda0f4a9.png) **DOMRect** https://developer.mozilla.org/en-US/docs/Web/API/DOMRect#methods ![image](https://user-images.githubusercontent.com/6358971/144598331-eebf41eb-eefb-4aa1-b71c-497f6a271313.png) **DOMPointReadOnly.toJSON()** https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly/toJSON

`DOMStringList` missing iterator method

[{"_id":"635adb47cecf4e081a21a2d8","body":"It exists:\r\n\r\nhttps:\/\/github.com\/microsoft\/TypeScript-DOM-lib-generator\/blob\/2173711b06b303e39ba0c1c4a3c6921ba48f7616\/baselines\/dom.iterable.generated.d.ts#L37-L39\r\n\r\nWhat does your tsconfig look like?","issue_id":1661112978121,"origin_id":983610218,"user_origin_id":3396686,"create_time":1638363112,"update_time":1638363112,"id":1666898759367,"updated_at":"2022-10-27T19:25:59.367000Z","created_at":"2022-10-27T19:25:59.367000Z"},{"_id":"635adb47cecf4e081a21a2d9","body":"here's the tsconfig: https:\/\/github.com\/widgetbot-io\/embed\/blob\/master\/tsconfig.json\r\n\r\nhere are the DOMStringList definitions VSCode found:\r\n\r\n![image](https:\/\/user-images.githubusercontent.com\/11778454\/144479560-a8f6f095-7bc1-49d2-ba51-77061aeb07d6.png)\r\n![image](https:\/\/user-images.githubusercontent.com\/11778454\/144479593-69e17931-585b-47bb-b389-c4c67928db10.png)\r\n\r\nIt's using VSCode's TS version (4.5.2) but I get the same error if I switch to the workspace version (4.2.2)","issue_id":1661112978121,"origin_id":984882627,"user_origin_id":11778454,"create_time":1638469335,"update_time":1638469335,"id":1666898759372,"updated_at":"2022-10-27T19:25:59.372000Z","created_at":"2022-10-27T19:25:59.372000Z"},{"_id":"635adb47cecf4e081a21a2da","body":"Ah sure, you also need to include \"dom.iterable\" next to \"dom\".","issue_id":1661112978121,"origin_id":984889704,"user_origin_id":3396686,"create_time":1638469895,"update_time":1638469895,"id":1666898759375,"updated_at":"2022-10-27T19:25:59.375000Z","created_at":"2022-10-27T19:25:59.375000Z"},{"_id":"635adb47cecf4e081a21a2db","body":"@orta could this kind of thing be autosuggested? \ud83e\udd14","issue_id":1661112978121,"origin_id":984890248,"user_origin_id":3396686,"create_time":1638469936,"update_time":1638469936,"id":1666898759378,"updated_at":"2022-10-27T19:25:59.377000Z","created_at":"2022-10-27T19:25:59.377000Z"},{"_id":"635adb47cecf4e081a21a2dc","body":"We've got a big chunk of checks in `getCannotFindNameDiagnosticForName` inside the compiler, (no point offering a link to the checker) but this can probably be added to that list. You have to manually set up your `lib` settings like this to trigger this case as the iteration version would be added by default if you include es2015\/es6+ in your target","issue_id":1661112978121,"origin_id":984971413,"user_origin_id":49038,"create_time":1638476480,"update_time":1638476480,"id":1666898759381,"updated_at":"2022-10-27T19:25:59.380000Z","created_at":"2022-10-27T19:25:59.380000Z"},{"_id":"635adb47cecf4e081a21a2dd","body":"> Ah sure, you also need to include \"dom.iterable\" next to \"dom\".\r\n\r\nThanks, that worked! Is there a reason it isn't included in dom?","issue_id":1661112978121,"origin_id":985104811,"user_origin_id":11778454,"create_time":1638490415,"update_time":1638490415,"id":1666898759384,"updated_at":"2022-10-27T19:25:59.384000Z","created_at":"2022-10-27T19:25:59.384000Z"},{"_id":"635adb47cecf4e081a21a2de","body":"> We've got a big chunk of checks in `getCannotFindNameDiagnosticForName` inside the compiler, (no point offering a link to the checker) but this can probably be added to that list.\r\n\r\nThere is no applicable identifier here (it's `...`), so I guess there should be some tweak.\r\n\r\n> Thanks, that worked! Is there a reason it isn't included in dom?\r\n\r\n`target: es5` does not support iterators, so including it by default would be confusing. But not including it is also confusing in 2021. \ud83e\udd14","issue_id":1661112978121,"origin_id":985138984,"user_origin_id":3396686,"create_time":1638495077,"update_time":1638495077,"id":1666898759386,"updated_at":"2022-10-27T19:25:59.386000Z","created_at":"2022-10-27T19:25:59.386000Z"},{"_id":"635adb47cecf4e081a21a2df","body":"This is solved, right?\r\n\r\n@github-actions close","issue_id":1661112978121,"origin_id":1250146180,"user_origin_id":3396686,"create_time":1663451732,"update_time":1663451732,"id":1666898759389,"updated_at":"2022-10-27T19:25:59.389000Z","created_at":"2022-10-27T19:25:59.389000Z"},{"_id":"635adb47cecf4e081a21a2e0","body":"Closing because @saschanaz is one of the code-owners of this repository.","issue_id":1661112978121,"origin_id":1250146211,"user_origin_id":41898282,"create_time":1663451747,"update_time":1663451747,"id":1666898759391,"updated_at":"2022-10-27T19:25:59.391000Z","created_at":"2022-10-27T19:25:59.391000Z"}] comment

TypeScript blocks using `[...location.ancestorOrigins]` with the error > Type 'DOMStringList' must have a '\[Symbol.iterator]()' method that returns an iterator. ts(2488) However, it is present in Chrome: ![image](https://user-images.githubusercontent.com/11778454/143518176-f340d276-3b05-45f7-a13a-bc4c8b63b469.png)

Reduce the use of `overrideType`

[{"_id":"635ae4298041c95dfb172998","body":"Could add a danger rule on PRs which just change the JSON, the hard bit from my side is knowing what to recommend?","issue_id":1661112978124,"origin_id":974092989,"user_origin_id":49038,"create_time":1637330108,"update_time":1637330117,"id":1666901033749,"updated_at":"2022-10-27T20:03:53.749000Z","created_at":"2022-10-27T20:03:53.749000Z"},{"_id":"635ae4298041c95dfb172999","body":"It's always better to override the other fields, if possible:\r\n\r\nhttps:\/\/github.com\/microsoft\/TypeScript-DOM-lib-generator\/blob\/315f15aee7a2d5c6d830ea90872fbd4e51fbbbd2\/src\/build\/types.d.ts#L2-L4","issue_id":1661112978124,"origin_id":974096530,"user_origin_id":3396686,"create_time":1637330370,"update_time":1637330378,"id":1666901033754,"updated_at":"2022-10-27T20:03:53.753000Z","created_at":"2022-10-27T20:03:53.753000Z"}] comment

`overrideType` is intended to be the last resort, but the existing uses confuse people and incorrectly guide them to use it when it's not the ideal way. See also https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1196

DOMString and friends are too narrow

[{"_id":"635ad274d297b6213235f01c","body":"Funny enough, my coworker @code-asher and I were just discussing this \u2014 specifically the `new URL(window.location);` example.\r\n\r\nWe were wondering if the type definition for `new URL` should be modified to accept `Location` but it sounds like that is only a partial solution.\r\n\r\nWe're using `new URL(window.location.toString());` as a current workaround. ","issue_id":1661112978127,"origin_id":971917171,"user_origin_id":3806031,"create_time":1637178447,"update_time":1637178447,"id":1666896500697,"updated_at":"2022-10-27T18:48:20.696000Z","created_at":"2022-10-27T18:48:20.696000Z"}] comment

[`DOMString`](https://developer.mozilla.org/en-US/docs/Web/API/DOMString), [`USVString`](https://developer.mozilla.org/en-US/docs/Web/API/USVString), [`CSSOMString`](https://developer.mozilla.org/en-US/docs/Web/API/CSSOMString) and [`ByteString`](https://developer.mozilla.org/en-US/docs/Web/API/ByteString) are currently mapped to simply `string`: https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/1fd97d19c109bc6ec2780605709f6e819356e942/src/helpers.ts#L53 However it doesn't include objects that can be stringified using the [`ToString`](https://tc39.es/ecma262/#sec-tostring) abstract operation. For example, the following...

Adjust `.parentElement` type to include `SVGElement`

[{"_id":"635ad99eea01ec786e7ce4d7","body":"Thanks for the PR!\n\nThis section of the codebase is owned by @saschanaz - if they write a comment saying \"LGTM\" then it will be merged.\n<!-- Message About Merging -->","issue_id":1661112978130,"origin_id":965070903,"user_origin_id":41898282,"create_time":1636546186,"update_time":1636546186,"id":1666898334031,"updated_at":"2022-10-27T19:18:54.030000Z","created_at":"2022-10-27T19:18:54.030000Z"},{"_id":"635ad99eea01ec786e7ce4d8","body":"Build has failed because you missed to include the generated files.\r\n\r\nBut did you considered the feedback from #1151 ?","issue_id":1661112978130,"origin_id":965074788,"user_origin_id":2410353,"create_time":1636546516,"update_time":1636546516,"id":1666898334037,"updated_at":"2022-10-27T19:18:54.036000Z","created_at":"2022-10-27T19:18:54.036000Z"},{"_id":"635ad99eea01ec786e7ce4d9","body":"Sorry, I've missed that discussion. I see the points raised there but having to cast this through unknown\/any first and then to `SVGElement` doesn't seem like a good DX. I understand that people might deal with SVG less often than with HTML but there should be a clear way of working with SVGs too. Not everyone might figure out how to \"properly\" cast this as it's not intuitive.\r\n\r\nIt also seems that there is no good list of \"expectations\" about the DOM types. A lot of this is gray area and the APIs don't provide full type safety. It would be great if things like this would be documented somewhere.","issue_id":1661112978130,"origin_id":966015785,"user_origin_id":9800850,"create_time":1636610763,"update_time":1636610763,"id":1666898334041,"updated_at":"2022-10-27T19:18:54.041000Z","created_at":"2022-10-27T19:18:54.041000Z"},{"_id":"635ad99eea01ec786e7ce4da","body":"Happy to have a FAQ of some sort, maybe this could be the first one? ","issue_id":1661112978130,"origin_id":969095256,"user_origin_id":49038,"create_time":1636994426,"update_time":1636994426,"id":1666898334045,"updated_at":"2022-10-27T19:18:54.044000Z","created_at":"2022-10-27T19:18:54.044000Z"},{"_id":"635ad99eea01ec786e7ce4db","body":"@orta where such a FAQ should live in? this repo? main TS docs?","issue_id":1661112978130,"origin_id":969096040,"user_origin_id":9800850,"create_time":1636994480,"update_time":1636994480,"id":1666898334048,"updated_at":"2022-10-27T19:18:54.047000Z","created_at":"2022-10-27T19:18:54.047000Z"},{"_id":"635ad99eea01ec786e7ce4dc","body":"In here I think, TypeScript's FAQ is already very very long","issue_id":1661112978130,"origin_id":969096935,"user_origin_id":49038,"create_time":1636994541,"update_time":1636994541,"id":1666898334050,"updated_at":"2022-10-27T19:18:54.050000Z","created_at":"2022-10-27T19:18:54.050000Z"}] comment

In reality, this also includes `| null` but this has been removed in https://github.com/microsoft/TypeScript-DOM-lib-generator/commit/2cd8ad3974b63affd454164028960821e77a2e17 so I guess you want to omit that for pragmatic reasons. Originally this was typed as...