denoland / denoland/std

tracking: Some modules cannot be marked as "browser compatible" because of outdated TS library types

Open
#1,973 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

## Context

The current browser compatibility CI test [uses TypeScript's native DOM types](https://github.com/denoland/deno_std/blob/main/browser-compat.tsconfig.json) when type-checking modules. This is appropriate.

However, the current DOM types appear to be outdated (technically, _misaligned_ from what's being commonly shipped by browsers), so it's not possible to get tests to pass for some modules which actually _are_ compatible in that sense.

## Problem

The above described scenario prevents marking some modules as being "browser compatible" and prevents their discovery as such. I've included links to examples at the end of this message.

## Candidate modules, grouped by related compiler diagnostic:

- [ ] `ReadableStream` lacks `[Symbol.asyncIterator]()` (missing in [latest snapshot, updated 2022-03-18](https://github.com/microsoft/TypeScript/blob/073ac920adee8e517350a455908aa420b29f9422/lib/lib.dom.iterable.d.ts#L219-L224))
Ref: https://github.com/denoland/deno_std/pull/1972#issuecomment-1054901936
Affects:
- [`streams/merge.ts`](https://github.com/denoland/deno_std/blob/main/streams/merge.ts)

- [ ] `ReadableStream` lacks any bytes & BYOB related typings (missing in [latest snapshot, updated 2022-03-05](https://github.com/microsoft/TypeScript/blob/857889a4e61741ecfbb3a8f39deb7db1c50f4d76/lib/lib.dom.d.ts#L1772), [latest snapshot, update 2022-03-05](https://github.com/microsoft/TypeScript/blob/857889a4e61741ecfbb3a8f39deb7db1c50f4d76/lib/lib.dom.d.ts#L11920))
Ref: https://github.com/denoland/deno_std/pull/1970#issuecomment-1059633244
Affects:
- [`streams/buffer.ts`](https://github.com/denoland/deno_std/blob/main/streams/buffer.ts)

- [x] `window.crypto` lacks `randomUUID()` (missing in [`4.5.5`](https://github.com/microsoft/TypeScript/blob/v4.5.5/lib/lib.dom.d.ts#L3600-L3605), available in [`4.6.2`](https://github.com/microsoft/TypeScript/blob/v4.6.2/lib/lib.dom.d.ts#L3646-L3653))
Ref: https://github.com/denoland/deno_std/pull/1972#issuecomment-1054923976
Affects:
- [`uuid/mod.ts`](https://github.com/denoland/deno_std/blob/main/uuid/mod.ts)
- [`uuid/v4.ts`](https://github.com/denoland/deno_std/blob/main/uuid/v4.ts)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.