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

URLSearchParams needs size #54466

Open
AndyOGo opened this issue May 31, 2023 · 3 comments
Open

URLSearchParams needs size #54466

AndyOGo opened this issue May 31, 2023 · 3 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@AndyOGo
Copy link

AndyOGo commented May 31, 2023

Bug Report

🔎 Search Terms

URLSearchParams

🕗 Version & Regression Information

TypeScript Version: typescript@4.9.5

  • This is a crash
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about URLSearchParams.size

⏯ Playground Link

Playground link with relevant code

💻 Code

console.log(new URLSearchParams().size)

🙁 Actual behavior

Property 'size' does not exist on type 'URLSearchParams'.ts(2339)

🙂 Expected behavior

No error

Related bug:

#38139

Note: Adding { "lib": ["dom.iterable"] } to my compilerOptions does not help.

@AndyOGo
Copy link
Author

AndyOGo commented May 31, 2023

Quick workaround is to extend "dom.iterable" locally, e.g.:

URLSearchParams.d.ts:

interface URLSearchParams {
  size: number;
}

@fatcerberus
Copy link

Makes sense, according to MDN it seems like this only landed in Chrome this month. TS tends to wait until at least 2 browser engines support an API before adding it to dom.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Jun 1, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 1, 2023
@bencmbrook
Copy link

bencmbrook commented Jul 25, 2023

This has rolled out to Chrome and Firefox since (Safari is in experimental) https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/size#browser_compatibility

Interestingly it looks like it's showing up in src/lib/dom.generated.d.ts now

https://github.com/microsoft/TypeScript/blob/2170e6c6cc12f08bfa2975955da2f145e4be6101/src/lib/dom.generated.d.ts#L22555-L22557

kodiakhq bot pushed a commit to vercel/next.js that referenced this issue Aug 17, 2023
Closes #49774 (and my dupe #53141), where there's a type error when attempting to construct URLSearchParams from ReadonlyURLSearchParams, [as recommended in the Next docs here](https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams) and breaks `next build` on Node v18.16.0+, including on Vercel.


This is blocked by TS publishing the new `dom` types (microsoft/TypeScript#54466). The [URL Standard](https://url.spec.whatwg.org/#dom-urlsearchparams-size) added the size property to URLSearchParams (whatwg/url#734) and this now has wide [browser support](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/size).
PeterYurkovich added a commit to PeterYurkovich/troubleshooting-panel-console-plugin that referenced this issue Apr 23, 2024
PeterYurkovich added a commit to PeterYurkovich/troubleshooting-panel-console-plugin that referenced this issue Apr 23, 2024
Add popup dialog and pieces needed for development environment

Add URL encoding/decoding for korrel8r queries and unit testing

Autofill query input with the page information

Remove state being saved in URL's since other plugins may be using it

Retrieve the graph of nearby Korrel8ted items.

Limiting to 5 for now to prevent excess growth, can be revisited later. Filtering labels down to what is needed and used

Remove sliding out the panel

Remove unused Korrel8r Page

Set query and response in redux state

Add more specific setup instructions to help people test the troubleshooting panel

Filter out unused nodes and edges

Convert query response to nodes and edges in topology

Fix CSS to not cause overflow of topology SVG past page length

Update korrel8r installation instructions to bypass current permission bug

Remove excess console logs

Finish removing korrel8r page

Swap to breadth first node sorting to align with the figma design

Finalize CSS changes

Migrate custom CSS to patternfly components and variables

Clear query when closing troubleshooting panel

Edges are omitted when blank

Immediately send query when opening panel

Use design icon for topology nodes

Update topology node labels

Clean up fetch functions

Remove some copied boilerplate that isn't needed. abort any still pending requests when unmounting

Alert and Log query <==> URL conversions

Add testing, add factory, add first pass at integrating with topology

Fix and test log corner cases

Add cyclical parsing to ensure no data is lost

Add metric url/query conversions

Add netflow query/url conversions

Remove the "or null" from static constructor return types since the functions now throw

Filter out 0 count queries

Move logic back into native JS URL functionality

Add type polyfill to prevent typescript errors

microsoft/TypeScript#54466

Incomplete progress on k8s query and url conversion. No testing and errors possible currently

Fix base alert URL

Fix testing verbiage

Add default k8 and event URL and query adjustment.

Update factory, and start using it in the topology on click

Fix query to alert to fill in name as well to filter down the results

Korrel8r just updated to 0.1.2, so define which version this works with

Update the topology to show the selected node based on the URL and show a blank canvas on first load

Add Troubleshooting Panel
PeterYurkovich added a commit to PeterYurkovich/troubleshooting-panel-console-plugin that referenced this issue Apr 26, 2024
Add popup dialog and pieces needed for development environment

Add URL encoding/decoding for korrel8r queries and unit testing

Autofill query input with the page information

Remove state being saved in URL's since other plugins may be using it

Retrieve the graph of nearby Korrel8ted items.

Limiting to 5 for now to prevent excess growth, can be revisited later. Filtering labels down to what is needed and used

Remove sliding out the panel

Remove unused Korrel8r Page

Set query and response in redux state

Add more specific setup instructions to help people test the troubleshooting panel

Filter out unused nodes and edges

Convert query response to nodes and edges in topology

Fix CSS to not cause overflow of topology SVG past page length

Update korrel8r installation instructions to bypass current permission bug

Remove excess console logs

Finish removing korrel8r page

Swap to breadth first node sorting to align with the figma design

Finalize CSS changes

Migrate custom CSS to patternfly components and variables

Clear query when closing troubleshooting panel

Edges are omitted when blank

Immediately send query when opening panel

Use design icon for topology nodes

Update topology node labels

Clean up fetch functions

Remove some copied boilerplate that isn't needed. abort any still pending requests when unmounting

Alert and Log query <==> URL conversions

Add testing, add factory, add first pass at integrating with topology

Fix and test log corner cases

Add cyclical parsing to ensure no data is lost

Add metric url/query conversions

Add netflow query/url conversions

Remove the "or null" from static constructor return types since the functions now throw

Filter out 0 count queries

Move logic back into native JS URL functionality

Add type polyfill to prevent typescript errors

microsoft/TypeScript#54466

Incomplete progress on k8s query and url conversion. No testing and errors possible currently

Fix base alert URL

Fix testing verbiage

Add default k8 and event URL and query adjustment.

Update factory, and start using it in the topology on click

Fix query to alert to fill in name as well to filter down the results

Korrel8r just updated to 0.1.2, so define which version this works with

Update the topology to show the selected node based on the URL and show a blank canvas on first load

Add Troubleshooting Panel

Move files to web folder, fix most of the feedback, fix topology bug

Move files to web folder, address some of the feedback, and fix the topology bug
PeterYurkovich added a commit to PeterYurkovich/troubleshooting-panel-console-plugin that referenced this issue Apr 29, 2024
Add popup dialog and pieces needed for development environment

Add URL encoding/decoding for korrel8r queries and unit testing

Autofill query input with the page information

Remove state being saved in URL's since other plugins may be using it

Retrieve the graph of nearby Korrel8ted items.

Limiting to 5 for now to prevent excess growth, can be revisited later. Filtering labels down to what is needed and used

Remove sliding out the panel

Remove unused Korrel8r Page

Set query and response in redux state

Add more specific setup instructions to help people test the troubleshooting panel

Filter out unused nodes and edges

Convert query response to nodes and edges in topology

Fix CSS to not cause overflow of topology SVG past page length

Update korrel8r installation instructions to bypass current permission bug

Remove excess console logs

Finish removing korrel8r page

Swap to breadth first node sorting to align with the figma design

Finalize CSS changes

Migrate custom CSS to patternfly components and variables

Clear query when closing troubleshooting panel

Edges are omitted when blank

Immediately send query when opening panel

Use design icon for topology nodes

Update topology node labels

Clean up fetch functions

Remove some copied boilerplate that isn't needed. abort any still pending requests when unmounting

Alert and Log query <==> URL conversions

Add testing, add factory, add first pass at integrating with topology

Fix and test log corner cases

Add cyclical parsing to ensure no data is lost

Add metric url/query conversions

Add netflow query/url conversions

Remove the "or null" from static constructor return types since the functions now throw

Filter out 0 count queries

Move logic back into native JS URL functionality

Add type polyfill to prevent typescript errors

microsoft/TypeScript#54466

Incomplete progress on k8s query and url conversion. No testing and errors possible currently

Fix base alert URL

Fix testing verbiage

Add default k8 and event URL and query adjustment.

Update factory, and start using it in the topology on click

Fix query to alert to fill in name as well to filter down the results

Korrel8r just updated to 0.1.2, so define which version this works with

Update the topology to show the selected node based on the URL and show a blank canvas on first load

Add Troubleshooting Panel

Move files to web folder, fix most of the feedback, fix topology bug

Move files to web folder, address some of the feedback, and fix the topology bug

Finish correcting review items, i18n and testing locations

Fix spacing

Use npm rather than yarn

Update tests to loop through inputs. Also remove already covered test cases
steven-tey added a commit to dubinc/dub that referenced this issue Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants