From f0e7887384f12a39a4489648739f2b68a9f06ebb Mon Sep 17 00:00:00 2001 From: Sujal Gupta Date: Mon, 8 Jul 2024 00:53:34 +0530 Subject: [PATCH 1/2] add missing interfaces for sub-classes of PerformanceEntry Signed-off-by: Sujal Gupta --- tests/lib/lib.d.ts | 86 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/tests/lib/lib.d.ts b/tests/lib/lib.d.ts index 7266b020156ab..ac6cecc26e3f1 100644 --- a/tests/lib/lib.d.ts +++ b/tests/lib/lib.d.ts @@ -11186,6 +11186,22 @@ declare var KeyboardEvent: { DOM_KEY_LOCATION_STANDARD: number; } +interface LargestContentfulPaint extends PerformanceEntry { +} + +declare var LargestContentfulPaint: { + prototype: LargestContentfulPaint; + new(): LargestContentfulPaint; +} + +interface LayoutShift extends PerformanceEntry { +} + +declare var LayoutShift: { + prototype: LayoutShift; + new(): LayoutShift; +} + interface Location { hash: string; host: string; @@ -12208,7 +12224,20 @@ interface Performance { clearResourceTimings(): void; getEntries(): any; getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; + getEntriesByType(entryType: 'element'): PerformanceElementTiming; + getEntriesByType(entryType: 'event'): PerformanceEventTiming; + getEntriesByType(entryType: 'first-input'): PerformanceEventTiming; + getEntriesByType(entryType: 'largest-contentful-paint'): LargestContentfulPaint; + getEntriesByType(entryType: 'layout-shift'): LayoutShift; + getEntriesByType(entryType: 'long-animation-frame'): PerformanceLongAnimationFrameTiming; + getEntriesByType(entryType: 'longtask'): PerformanceLongTaskTiming; + getEntriesByType(entryType: 'mark'): PerformanceMark; + getEntriesByType(entryType: 'measure'): PerformanceMeasure; + getEntriesByType(entryType: 'navigation'): PerformanceNavigationTiming; + getEntriesByType(entryType: 'paint'): PerformancePaintTiming; + getEntriesByType(entryType: 'resource'): PerformanceResourceTiming; + getEntriesByType(entryType: 'taskattribution'): TaskAttributionTiming; + getEntriesByType(entryType: 'visibility-state'): VisibilityStateEntry; getMarks(markName?: string): any; getMeasures(measureName?: string): any; mark(markName: string): void; @@ -12235,6 +12264,38 @@ declare var PerformanceEntry: { new(): PerformanceEntry; } +interface PerformanceElementTiming extends PerformanceEntry { +} + +declare var PerformanceElementTiming: { + prototype: PerformanceElementTiming; + new(): PerformanceElementTiming; +} + +interface PerformanceEventTiming extends PerformanceEntry { +} + +declare var PerformanceEventTiming: { + prototype: PerformanceEventTiming; + new(): PerformanceEventTiming; +} + +interface PerformanceLongAnimationFrameTiming extends PerformanceEntry { +} + +declare var PerformanceLongAnimationFrameTiming: { + prototype: PerformanceLongAnimationFrameTiming; + new(): PerformanceLongAnimationFrameTiming; +} + +interface PerformanceLongTaskTiming extends PerformanceEntry { +} + +declare var PerformanceLongTaskTiming: { + prototype: PerformanceLongTaskTiming; + new(): PerformanceLongTaskTiming; +} + interface PerformanceMark extends PerformanceEntry { } @@ -12300,6 +12361,14 @@ declare var PerformanceNavigationTiming: { new(): PerformanceNavigationTiming; } +interface PerformancePaintTiming extends PerformanceEntry { +} + +declare var PerformancePaintTiming: { + prototype: PerformancePaintTiming; + new(): PerformancePaintTiming; +} + interface PerformanceResourceTiming extends PerformanceEntry { connectEnd: number; connectStart: number; @@ -14512,6 +14581,14 @@ declare var SubtleCrypto: { new(): SubtleCrypto; } +interface TaskAttributionTiming extends PerformanceEntry { +} + +declare var TaskAttributionTiming: { + prototype: TaskAttributionTiming; + new(): TaskAttributionTiming; +} + interface Text extends CharacterData { wholeText: string; replaceWholeText(content: string): Text; @@ -14889,6 +14966,13 @@ declare var VideoTrackList: { new(): VideoTrackList; } +interface VisibilityStateEntry extends PerformanceEntry { +} + +declare var VisibilityStateEntry: { + prototype: VisibilityStateEntry; + new(): VisibilityStateEntry; +} interface WEBGL_compressed_texture_s3tc { COMPRESSED_RGBA_S3TC_DXT1_EXT: number; COMPRESSED_RGBA_S3TC_DXT3_EXT: number; From f2ebc771b759534bf89ca81e0d6a8f7966d586a3 Mon Sep 17 00:00:00 2001 From: Sujal Gupta Date: Sun, 4 Aug 2024 17:41:59 +0530 Subject: [PATCH 2/2] remove getEntriesByType entries from Performance interface for unsupported types Signed-off-by: Sujal Gupta --- tests/lib/lib.d.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/lib/lib.d.ts b/tests/lib/lib.d.ts index ac6cecc26e3f1..d918a55ae0ae3 100644 --- a/tests/lib/lib.d.ts +++ b/tests/lib/lib.d.ts @@ -12224,13 +12224,8 @@ interface Performance { clearResourceTimings(): void; getEntries(): any; getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: 'element'): PerformanceElementTiming; - getEntriesByType(entryType: 'event'): PerformanceEventTiming; getEntriesByType(entryType: 'first-input'): PerformanceEventTiming; - getEntriesByType(entryType: 'largest-contentful-paint'): LargestContentfulPaint; - getEntriesByType(entryType: 'layout-shift'): LayoutShift; getEntriesByType(entryType: 'long-animation-frame'): PerformanceLongAnimationFrameTiming; - getEntriesByType(entryType: 'longtask'): PerformanceLongTaskTiming; getEntriesByType(entryType: 'mark'): PerformanceMark; getEntriesByType(entryType: 'measure'): PerformanceMeasure; getEntriesByType(entryType: 'navigation'): PerformanceNavigationTiming;