simpl-schema: TypeError: Array.includes is not a function @0.0.4
I got this error message in both client (Chrome v.57) & server code.
I20161228-11:17:22.178(7)? Exception in setInterval callback: TypeError: Array.includes is not a function
I20161228-11:17:22.180(7)? at Object.runAV (node_modules\simpl-schema\dist\clean\setAutoValues.js:51:15)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 12
- Comments: 17 (1 by maintainers)
Personally, I prefer @eluck 's last snippet. It’s small, and essentially the only thing required. Adding the entire
babel-polyfillseems overkill.Preferably, this should be refactored in this source, though.
Created a PR (#42) to fix this issue. Given the project already requires underscore, I opted for using
_.contains.Update:
If everywhere in the app I change the import:
to
the error message
TypeError: Array.includes is not a functiondisappears.@seabrus I can confirm that install
babel-polyfillwithnpm install babel-polyfill --save-devand import it to my page asimport 'babel-polyfill';can fix this issue.@aldeed can you suggest better way to fix this?
@dburles Pretty sure that was fixed when this got merged. I’ve removed
babel-polyfillfrom my project and haven’t seen any issues.@saeedjalali1 because
babel-polyfillwas removed and the code still make use ofArray.includes(notArray.prototype.includes), which is defined bybabel-polyfill. It seems that this test case was not covered. Added a stub forArray.includesor includingbabel-polyfillback into your project resolves this as both declare the required, missing, implementation.The proper solution, however, is for this repository to properly call an alternative implementation and not use
Array.includesat all. Becausebabel-polyfillis completely useless in this case.