Skip to content

Commit e4c2fff

Browse files
authored
fix(types): restore brotli in CompressionFormat for dom/webworker libs (#34349)
The TypeScript 6.0.3 update (#32944) regenerated `lib.dom.d.ts` and `lib.webworker.d.ts` from upstream and dropped the brotli patch we had applied to `CompressionFormat`. Projects whose `compilerOptions.lib` includes `dom` or `webworker` then fail to type-check `new CompressionStream("brotli")`, even though Deno supports brotli at runtime. Type aliases can't be merged across lib files, so the patch has to live in the vendored TypeScript libs themselves. To stop this from regressing silently on the next upgrade, this also adds a small spec test that runs `deno check` against `CompressionStream("brotli")` / `DecompressionStream("brotli")` under the default, `dom`, and `webworker` lib configurations. Fixes #34324
1 parent 5bd5a3b commit e4c2fff

6 files changed

Lines changed: 34 additions & 2 deletions

File tree

cli/tsc/dts/lib.dom.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44283,7 +44283,7 @@ type ColorGamut = "p3" | "rec2020" | "srgb";
4428344283
type ColorSpaceConversion = "default" | "none";
4428444284
type CompositeOperation = "accumulate" | "add" | "replace";
4428544285
type CompositeOperationOrAuto = "accumulate" | "add" | "auto" | "replace";
44286-
type CompressionFormat = "deflate" | "deflate-raw" | "gzip";
44286+
type CompressionFormat = "deflate" | "deflate-raw" | "gzip" | "brotli";
4428744287
type CookieSameSite = "lax" | "none" | "strict";
4428844288
type CredentialMediationRequirement = "conditional" | "optional" | "required" | "silent";
4428944289
type DOMParserSupportedType = "application/xhtml+xml" | "application/xml" | "image/svg+xml" | "text/html" | "text/xml";

cli/tsc/dts/lib.webworker.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15087,7 +15087,7 @@ type ClientTypes = "all" | "sharedworker" | "window" | "worker";
1508715087
type CodecState = "closed" | "configured" | "unconfigured";
1508815088
type ColorGamut = "p3" | "rec2020" | "srgb";
1508915089
type ColorSpaceConversion = "default" | "none";
15090-
type CompressionFormat = "deflate" | "deflate-raw" | "gzip";
15090+
type CompressionFormat = "deflate" | "deflate-raw" | "gzip" | "brotli";
1509115091
type CookieSameSite = "lax" | "none" | "strict";
1509215092
type DocumentVisibilityState = "hidden" | "visible";
1509315093
type EncodedAudioChunkType = "delta" | "key";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"tempDir": true,
3+
"tests": {
4+
"default_lib": {
5+
"args": "check --quiet default.ts",
6+
"output": ""
7+
},
8+
"dom_lib": {
9+
"args": "check --quiet --config dom.json default.ts",
10+
"output": ""
11+
},
12+
"webworker_lib": {
13+
"args": "check --quiet --config webworker.json default.ts",
14+
"output": ""
15+
}
16+
}
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Regression test for https://github.com/denoland/deno/issues/34324
2+
// Ensure that "brotli" stays in `CompressionFormat` across TypeScript upgrades,
3+
// in `lib.deno_web.d.ts`, `lib.dom.d.ts`, and `lib.webworker.d.ts`.
4+
const _compress = new CompressionStream("brotli");
5+
const _decompress = new DecompressionStream("brotli");
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["esnext", "dom"]
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["esnext", "webworker"]
4+
}
5+
}

0 commit comments

Comments
 (0)