Ability to extend static Event interface #22946
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main idea
Moved EventConstructor to separate interface for better extensibility.
Before this patch Event was declared with literal:
in that case there is no ability to add static properties to Event using declaration merging.
Moved EventConstructor to separate named interface, now anyone can extend it in own project using declaration merging, same idea as ArrayConstructor declaration:
As far as I know, this change made no side effects for anyone.
And some additional questions
1. Strange changes in dom.generated.d.ts
src\lib\dom.generated.d.ts git shows that 1144 lines added and 1143 removed, but TortoiseGitMerge shows only some lines changed(event declaration). Github shows many lines changed. I`m using Windows 10 may be it is line ending problem, but file is autogenerated, what should i do to make diff clear?
2. const vs var
Array declared:
But Event declared:
Should all declarations be const or var?
3. Different declarations fo Event in different files
Declaration of Event declared in tests\lib\lib.d.ts:
differs from Event declared in all another d.ts files:
shoul this declarations be equal? By meaning they are equal now.
4. Convert another declarations?
Would it be better to convert all
delare var/const
declarations with literal type to separate named types?May be some questions better to convert to separate issues for discussion?