mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
feat(node, perf_hooks): add entryType to all types and interfaces that use it (#42428)
* feat: add entry type Accorded to document https://nodejs.org/api/perf_hooks.html\#perf_hooks_performanceentry_entrytype entry should have its own type, not a string type. * chore: add contributer name * feat(node): add entry type
This commit is contained in:
Vendored
+1
@@ -41,6 +41,7 @@
|
||||
// Minh Son Nguyen <https://github.com/nguymin4>
|
||||
// Junxiao Shi <https://github.com/yoursunny>
|
||||
// Ilia Baryshnikov <https://github.com/qwelias>
|
||||
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.5.
|
||||
|
||||
Vendored
+10
-8
@@ -1,5 +1,7 @@
|
||||
declare module "perf_hooks" {
|
||||
import { AsyncResource } from "async_hooks";
|
||||
declare module 'perf_hooks' {
|
||||
import { AsyncResource } from 'async_hooks';
|
||||
|
||||
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
|
||||
|
||||
interface PerformanceEntry {
|
||||
/**
|
||||
@@ -22,7 +24,7 @@ declare module "perf_hooks" {
|
||||
* The type of the performance entry.
|
||||
* Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'.
|
||||
*/
|
||||
readonly entryType: string;
|
||||
readonly entryType: EntryType;
|
||||
|
||||
/**
|
||||
* When performanceEntry.entryType is equal to 'gc', the performance.kind property identifies
|
||||
@@ -133,7 +135,7 @@ declare module "perf_hooks" {
|
||||
* @param type
|
||||
* @return list of all PerformanceEntry objects
|
||||
*/
|
||||
getEntriesByName(name: string, type?: string): PerformanceEntry[];
|
||||
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* Returns a list of all PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
|
||||
@@ -141,7 +143,7 @@ declare module "perf_hooks" {
|
||||
* @param type
|
||||
* @return list of all PerformanceEntry objects
|
||||
*/
|
||||
getEntriesByType(type: string): PerformanceEntry[];
|
||||
getEntriesByType(type: EntryType): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* Creates a new PerformanceMark entry in the Performance Timeline.
|
||||
@@ -202,13 +204,13 @@ declare module "perf_hooks" {
|
||||
* @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
|
||||
* whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type.
|
||||
*/
|
||||
getEntriesByName(name: string, type?: string): PerformanceEntry[];
|
||||
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
||||
|
||||
/**
|
||||
* @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
|
||||
* whose performanceEntry.entryType is equal to type.
|
||||
*/
|
||||
getEntriesByType(type: string): PerformanceEntry[];
|
||||
getEntriesByType(type: EntryType): PerformanceEntry[];
|
||||
}
|
||||
|
||||
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
|
||||
@@ -227,7 +229,7 @@ declare module "perf_hooks" {
|
||||
* Property buffered defaults to false.
|
||||
* @param options
|
||||
*/
|
||||
observe(options: { entryTypes: string[], buffered?: boolean }): void;
|
||||
observe(options: { entryTypes: EntryType[]; buffered?: boolean }): void;
|
||||
}
|
||||
|
||||
namespace constants {
|
||||
|
||||
Reference in New Issue
Block a user