refactor: move Temporal types to separate lib.temporal.d.ts#32571
refactor: move Temporal types to separate lib.temporal.d.ts#32571bartlomieju merged 6 commits intodenoland:mainfrom
Conversation
Moves Temporal API type definitions from lib.deno.unstable.d.ts to a new lib.temporal.d.ts file, and references it from lib.deno.window.d.ts and lib.deno.worker.d.ts. This fixes the issue where users who explicitly set compilerOptions.lib would lose Temporal types unless they also included "deno.unstable". Since Temporal is now stable in Deno 2.x (no longer behind --unstable-temporal), users should get Temporal types automatically when using deno.window. Closes denoland#32468
|
|
…ypes-to-separate-lib
The temporal types refactoring shifted `declare var name` in lib.deno.window.d.ts by one line (599 -> 600 zero-indexed). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Wouldn't it have made more sense to reference As a case in point, the current suggestion for type checking in combined browser and Deno environments is to use: {
"compilerOptions": {
"lib": ["dom", "deno.ns"]
}
}I think it would be even better to reference it from Aside, if you'd like to enable the Temporal API separately (in above scenario), then the current |
|
@maikdevries feel free to open a PR to change it |
|
I'd be happy to do so but first need some clarifications:
|
|
|
To answer the first: #32656 seems to have introduced So if I understand correctly, there's nothing for me to do other than wait for the next release and it will sort itself out automatically (both |
|
Good catch - you can try this already with |
Add "esnext.temporal" to the lib_names list in get_types_declaration_file_text() so that `deno types` emits the Temporal namespace declarations from TypeScript's lib.esnext.temporal.d.ts. This was accidentally removed in denoland#32656 (typescript-go update) which dropped the "deno.temporal" entry added by denoland#32571. Since deno types does flat concatenation (doesn't follow /// <reference> chains), the Temporal types were silently lost from the output. Closes denoland#32950 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary Add `"esnext.temporal"` to the `lib_names` list in `get_types_declaration_file_text()` so that `deno types` emits the Temporal namespace declarations from TypeScript's `lib.esnext.temporal.d.ts`. This was accidentally removed in #32656 (typescript-go update) which dropped the `"deno.temporal"` entry added by #32571. Since `deno types` does flat concatenation (doesn't follow `/// <reference>` chains), the Temporal types were silently lost from the output, breaking docs generation at docs.deno.com. Closes #32950 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Moves Temporal API type definitions from
lib.deno.unstable.d.tsto a newlib.temporal.d.tsfile, and references it fromlib.deno.window.d.tsandlib.deno.worker.d.ts.Problem
When users explicitly set
compilerOptions.libin theirdeno.json, they lose Temporal types unless they also include"deno.unstable". This is confusing because:--unstable-temporal)Solution
Create a separate
lib.temporal.d.tsthat is auto-included vialib.deno.window.d.tsandlib.deno.worker.d.ts. This ensures Temporal types are always available when using the standard Deno libs.This approach was suggested in #32468 (comment) and aligns with TypeScript's plan to add
esnext.temporal.d.tsin TS 6.0.Closes #32468