-
Notifications
You must be signed in to change notification settings - Fork 440
Add overrides for interface types and add CustomEvent types for testing. #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
inputfiles/overridingTypes.json
Outdated
@@ -1,5 +1,40 @@ | |||
[ | |||
{ | |||
"kind": "typedinterface", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i do not think you need a new kind here.. just add a property typeParameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would kind
be interface
and then parameters
would become typeParameters
?
Much better approach. I have updated the code to reflect the requested changes. |
inputfiles/overridingTypes.json
Outdated
"interface": "CustomEvent", | ||
"name": "initCustomEvent", | ||
"signatures": [ | ||
"(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to include the name here. i.e. initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T)
@@ -2374,9 +2374,9 @@ declare var CSSSupportsRule: { | |||
new(): CSSSupportsRule; | |||
}; | |||
|
|||
interface CustomEvent extends Event { | |||
readonly detail: any; | |||
initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name of the method is missing.
baselines/dom.generated.d.ts
Outdated
initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; | ||
interface CustomEvent<T = any> extends Event { | ||
readonly detail: T; | ||
(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void; | ||
} | ||
|
||
declare var CustomEvent: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to change this one too, this is your entry point to an event.. it should be:
declare var CustomEvent: {
prototype: CustomEvent;
new<T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
};
…stomEvent was correct.
|
baselines/dom.generated.d.ts
Outdated
interface CustomEventInit extends EventInit { | ||
detail?: any; | ||
interface CustomEventInit<T = any> extends EventInit { | ||
detail: T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detail
should still be optional? or is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good otherwise. thanks!
It is now optional. Thanks! Good learning experience I will likely have more PRs in the future. |
@jthoms1 thank you for stepping up and seeing this through! I got stuck at the F# stuff and never made it through |
@arjunyel No worries, I really wanted this. Your work started it! 😄 |
This PR will fix microsoft/TypeScript#14785 and replace #304.
In order to override interfaces and add types this PR updates the TS.fsx and adds a new override type called
typedinterface
. The naming convention was provided here #304 (comment)This is my first time writing F# so please let me know if I need to make changes to the convention or if I missed an interfaces beyond Dictionaries or Interface Declarations.