-
Notifications
You must be signed in to change notification settings - Fork 458
add FormData typing to webworker #231
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
| { | ||
| "kind": "constructor", | ||
| "interface": "FormData", | ||
| "flavor": "DOM", |
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 think you mean "web"
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 change it to Web, but seem still not work.
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.
And I guess the origin FormData constructor definition is ininputfiles/browser.webidl.xml#L4303.
baselines/webworker.generated.d.ts
Outdated
|
|
||
| declare var FormData: { | ||
| prototype: FormData; | ||
| new (form?: HTMLFormElement): FormData; |
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.
Tis is failing the CI tests:
generated/webworker.generated.d.ts(459,17): error TS2304: Cannot find name 'HTMLFormElement'.
you will need to update this for WebWorkers only to be string i presume.
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.
@mhegazy The IDL spec says Constructor(optional HTMLFormElement form). So I think it should be empty rather than a string.
| let removedCtor = getRemovedItems ItemKind.Constructor flavor |> Array.tryFind (matchInterface i.Name) | ||
| if Option.isNone removedCtor then | ||
| let overriddenCtor = getOverriddenItems ItemKind.Constructor Flavor.All |> Array.tryFind (matchInterface i.Name) | ||
| let overriddenCtor = getOverriddenItems ItemKind.Constructor flavor |> Array.tryFind (matchInterface i.Name) |
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.
@mhegazy After looking into this generating script, I found out the reason why "flavor": "Web" in inputfiles/overridingTypes.json is ignored is that it always use Flavor.All to EmitConstructorSignature.
FormDatais also available in worker. (IDL spec).Problem
The
FormDatadeclaration in DOM isBut
HTMLFormElementis not available in worker. So I think we should change the constructor to:(but can't find related info in w3c spec)
I add a
flavortoinputfiles/overridingTypes.json, but it seems not work. How can I achieve this?