Closed
Description
TypeScript Version: 3.4.0-dev.20190323
Search Terms:
URLSearchParams, FormData
Code
let form = document.createElement('form')
console.log(new URLSearchParams(new FormData(form)))
Expected behavior:
compilation succeeds and an (empty) URLSearchParams
instance is constructed using the provided FormData
. The above code runs without issue on Chrome 73 and Firefox 67 for me.
Actual behavior:
compilation fails because URLSearchParams
doesn't explicitly allow an argument of type FormData
as input to the constructor.
Argument of type 'FormData' is not assignable to parameter of type 'string | Record<string, string> | URLSearchParams | string[][]'.
Property 'sort' is missing in type 'FormData' but required in type 'URLSearchParams'.
Playground Link:
link