-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Description
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 | ![]() |
after | ![]() |
If it's OK for you - what would be the best way to submit these changes?
mandrzejczak and dnaploszek
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
performance.measure()
to overloads #1280yume-chan commentedon Mar 2, 2022
Your fourth overload is invalid, it has a required argument after an optional argument.
I did the conversion in #1280, basically the steps are:
interface
, adictionary
or something else like a callback.inputfiles/overridingTypes.jsonc
, search for existed entries for your type, if nothing found, add a new entry in the corresponding section (interface
,dictionary
, etc.)npm install
,npm build
,npm baseline-accept
,npm run test
baselines
is what you want, and there is no test errors.