microsoft / microsoft/TypeScript
Add types for window.performance.getEntriesByType
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Search Terms
getEntriesByType
PerformanceMark
PerformanceMeasure
PerformanceResourceTiming
Suggestion
Add types for the getEntriesByType API
I found this old issue (Jul 5, 2018) and saw that experimental API's are not included in lib.dom.d.ts. The following API's don't appear to have experimental warnings on them on the MDN docs. Hopefully this means these are no longer experimental and types can be added now?
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMark
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMeasure
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming
Use Cases
Getting specific strongly typed information for the entries when accessed via this API.
Examples
// resources would be of type PerformanceResourceTiming[]
const resources = window.navigation.getEntriesByType("resource");
// resources would be of type PerformanceMeasure[]
const measures = window.navigation.getEntriesByType("measure");
// marks would be of type PerformanceMark[]
const marks = window.navigation.getEntriesByType("mark");
// paints would still be of type PerformanceEntryList
const paints = window.navigation.getEntriesByType("paint");
Checklist
My suggestion meets these guidelines (not sure about the first one):
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die im Issue verlinkten MDN-Seiten und die vorhandenen Deklarationen in lib.dom.d.ts zu lesen, und überprüfe die Abweichung zwischen window.performance im Titel und window.navigation in den Beispielen. Als erledigt gilt die Aufgabe, wenn getEntriesByType die angeforderten spezifischen Typen für Einträge vom Typ resource, measure und mark bereitstellt und dabei den vorhandenen breiten Typ für paint-Einträge beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100