question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Losing type information - "Property get never defined on formData of type FormData"

See original GitHub issue

Hi all,

I’m getting some strange compiler warnings. It’s like the compiler forgets the externs for FormData - see here:

[npm 04/13/17 2:30:27] nps-plugin/index.js:150: WARNING - Property get never defined on formData of type FormData
[npm 04/13/17 2:30:27]           this.userName || formData.get('user_name'),
[npm 04/13/17 2:30:27]                            ^^^^^^^^^^^^
[npm 04/13/17 2:30:27] 
[npm 04/13/17 2:30:27] nps-plugin/index.js:152: WARNING - Property get never defined on formData of type FormData
[npm 04/13/17 2:30:27]           formData.get('score'),
[npm 04/13/17 2:30:27]           ^^^^^^^^^^^^
[npm 04/13/17 2:30:27] 
[npm 04/13/17 2:30:27] nps-plugin/index.js:153: WARNING - Property get never defined on formData of type FormData
[npm 04/13/17 2:30:27]           this.productId || formData.get('product_id'),
[npm 04/13/17 2:30:27]                             ^^^^^^^^^^^^
[npm 04/13/17 2:30:27] 
[npm 04/13/17 2:30:27] nps-plugin/index.js:154: WARNING - Property get never defined on formData of type FormData
[npm 04/13/17 2:30:27]           formData.get('comments')));

I’m not sure if it’s related, but the properties on the Form elements elements property seem to be obfuscated as well:

I have to use form.elements['score'].value rather than what I had before, which was form.elements.score.value. Come to think of it, since the “score” element is dynamically defined (and thusly the compiler’d have no way of preserving the token), I have no idea why that was working before…

Here’s my compiler info:

VERSION: 20161201.0.0

FLAGS: java -jar node_modules/google-closure-compiler/compiler.jar –js=“nps-plugin/index.js” –js=“node_modules/google-closure-library/closure/goog/.js” –js=“!node_modules/google-closure-library/closure/goog/_test.js” –dependency_mode=STRICT –compilation_level=ADVANCED_OPTIMIZATIONS –entry_point=lnkd.NpsPlugin –output_wrapper=“(function(){%output%})();” –new_type_inf –jscomp_warning=newCheckTypes –jscomp_off=newCheckTypesExtraChecks –hide_warnings_for=node_modules/google-closure-library/ –output_manifest=“build/report/manifest.MF” –js_output_file=nps-plugin.js

Let me know if you can help… thanks so much!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dimvarcommented, Apr 13, 2017

Can you file an issue internally, with steps for me how to build your project and reproduce the error?

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript Property 'formData' does not exist on type 'Event'?
I see you're using the sample from MDN's formdata event. The event type you're looking for is FormDataEvent which provides the formData ......
Read more >
Can't get a .post with 'Content-Type': 'multipart/form-data' to work
When I try to send the request with Axios, seems like data goes as an empty string so the backend will respond with...
Read more >
FormData - The Modern JavaScript Tutorial
FormData objects are used to capture HTML form and submit it using fetch or another network method. We can either create new FormData(form) ......
Read more >
Property is missing in type 'X' but required in type 'Y' | bobbyhadz
The TypeScript error "Property is missing in type but required in type" occurs when we do not set all of the properties an...
Read more >
FormData.append() - Web APIs | MDN
The append() method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found