When trying to use window.FormData
I get the following error:
The name 'FormData' does not exist in the current scope
The same happens to FileReader
When trying to use window.FormData
I get the following error:
The name 'FormData' does not exist in the current scope
The same happens to FileReader
Share Improve this question edited Jun 1, 2013 at 21:21 MiMo 12k1 gold badge34 silver badges48 bronze badges asked May 31, 2013 at 22:51 localhostlocalhost 9213 gold badges15 silver badges32 bronze badges 4 |2 Answers
Reset to default 17add dom
to the lib
array in the tsconfig.json
of your project.
{
"compilerOptions": {
...
"lib": ["es2018", "dom"], // add `dom` to the array
...
}
}
You can check a feature exists using:
if (window.FormData) {
alert('Yes');
}
This relies on falsey checks - if you want to be explicit, use.
if (typeof FormData !== 'undefined') {
alert('Yes');
}
FormData
withoutwindow
prefix? – raina77ow Commented May 31, 2013 at 23:06