Skip to content

performance.measure() overloads instead of optional arguments #1239

Open
@lgodziejewski

Description

@lgodziejewski

Hey there

according to MDN Docs, the performance.measure() fn has 4 different argument sets (overloads) - the current typing suggests only one and marks some of the args as optional.

Perhaps it'd be better to have the 4 overloads listed explicitly? i.e. instead of:

measure(measureName: string, startOrMeasureOptions?: string | PerformanceMeasureOptions, endMark?: string): PerformanceMeasure;

have sth like:

measure(measureName: string): PerformanceMeasure
measure(measureName: string, MeasureOptions: PerformanceMeasureOptions): PerformanceMeasure
measure(measureName: string, startMark: string): PerformanceMeasure
measure(measureName: string, startMark?: string, endMark: string): PerformanceMeasure

WDYT? This would enable better autocomplete suggestions in code editors (notice the 1/3 on the 2nd pic):

when pic
before image
after image

If it's OK for you - what would be the best way to submit these changes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions