fix(lib): add PerformanceObserver and PerformanceObserverEntryList types#35640
Open
bartlomieju wants to merge 1 commit into
Open
fix(lib): add PerformanceObserver and PerformanceObserverEntryList types#35640bartlomieju wants to merge 1 commit into
bartlomieju wants to merge 1 commit into
Conversation
PerformanceObserver and PerformanceObserverEntryList exist at runtime but were
not declared in Deno's default libs (only lib.webworker has them, which the
deno.window lib does not load). As a result, using PerformanceObserverEntryList
as a type errored with TS2749 ('refers to a value, but is being used as a type')
and PerformanceObserver had no proper type. Add the interfaces + constructors to
lib.deno.shared_globals alongside the existing Performance* declarations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PerformanceObserverandPerformanceObserverEntryListexist at runtime inDeno but were never declared in the default libs — only
lib.webworker.d.tsdeclares them, and the
deno.windowlib doesn't load it. As a result:PerformanceObserverEntryListused as a type errored withTS2749("'PerformanceObserverEntryList' refers to a value, but is being used as a type
here"), even though the value exists at runtime.
This adds the
PerformanceObserver,PerformanceObserverEntryList, andPerformanceObserverCallbackdeclarations tolib.deno.shared_globals.d.tsnext to the existing
Performance/PerformanceEntry/PerformanceMark/PerformanceMeasureones, so both are usable as values and types in Deno code.Part of the broader effort to drop Deno's forked TypeScript; see #35621 for context and the overall plan.