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

The dom lib is missing typings for ReadableStream.from #21981

Closed
BlackAsLight opened this issue Jan 18, 2024 · 3 comments · Fixed by #24599
Closed

The dom lib is missing typings for ReadableStream.from #21981

BlackAsLight opened this issue Jan 18, 2024 · 3 comments · Fixed by #24599
Labels
bug Something isn't working correctly types Issues related to TypeScript types upstream Changes in upstream are required to solve these issues

Comments

@BlackAsLight
Copy link

Version: Deno 1.39.4

Really just forwarding this comment since that issue is closed and therefore seems to not be on anyone's radar.
#21733 (comment)

Example

This code runs successfully, but throws a typing error on .from

function* example() {
	yield 1
}

const stream = ReadableStream.from(example())

for await (const value of stream)
	console.log(value)
{
	"compilerOptions": {
		"lib": [
			"dom",
			"deno.ns"
		]
	}
}
@ry ry added bug Something isn't working correctly good first issue Good for newcomers labels Jan 27, 2024
@kt3k
Copy link
Member

kt3k commented Jan 30, 2024

We usually don't update lib.dom.d.ts with our own modification, but directly follow the updates from TypeScript repository. Should this case be considered as an exception? cc @dsherret @bartlomieju

@kt3k
Copy link
Member

kt3k commented Jan 30, 2024

A feature needs to be supported by two or more major browser engines to be included here, to make sure there is a good consensus among vendors: Gecko (Firefox), Blink (Chrome/Edge), and WebKit (Safari).

https://github.com/microsoft/TypeScript-DOM-lib-generator

lib.dom has the above criteria to include new APIs and ReadableStream.from doesn't meet it yet (ReadableStream.from is only supported by firefox)

@Hajime-san
Copy link
Contributor

It's a temporary measures that overwriting deno.web next in dom to lib array.
But, there is a possibility to cause other typing issues...

{
  "compilerOptions": {
    "lib": [
      "dom",
      "deno.web"
    ]
  }
}

BTW, it's not only Readable.from problem but other APIs that is not implementing commonly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly types Issues related to TypeScript types upstream Changes in upstream are required to solve these issues
Projects
None yet
5 participants