I'm having a new issue with node v6.3.1 and hapi v14.1.0.
A handler function with request.query.hasOwnProperty('whatever') will result in a "request.query.hasOwnProperty is not a function" error.
Changing to Object.prototype.hasOwnProperty.call(request.query, 'whatever') works.
typeof request is 'object', so I'm not sure why this method is missing or why calling it from Object works.
This is expected. https://github.com/nodejs/node/pull/6289 modified the query object returned by the querystring module such that it uses a null prototype, and therefore does not inherit the base properties and methods of ordinary Object instances. This was done intentionally to address some bugs that are detailed in the PR. Your workaround is the proper alternative.
Thanks @jasnell. Closing issue.
Could a change to the querystring type file help with this? TypeScript should definitely be throwing an error
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
This is expected. https://github.com/nodejs/node/pull/6289 modified the
queryobject returned by thequerystringmodule such that it uses anullprototype, and therefore does not inherit the base properties and methods of ordinaryObjectinstances. This was done intentionally to address some bugs that are detailed in the PR. Your workaround is the proper alternative.