Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.hasOwn is not a function #772

Closed
4 tasks done
blechatellier opened this issue Sep 29, 2023 · 4 comments
Closed
4 tasks done

Object.hasOwn is not a function #772

blechatellier opened this issue Sep 29, 2023 · 4 comments
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on

Comments

@blechatellier
Copy link

Initial checklist

Affected packages and versions

9.0.0

Link to runnable example

No response

Steps to reproduce

I'm using NextJS and after upgrading from v8.0.7 to v9.0.0 I get the following error Object.hasOwn is not a function which is not supported by all browsers (chrome v93+), can we keep hasOwnProperty instead?

Expected behavior

It should not throw an error.

Actual behavior

It throws an Uncaught TypeError Object.hasOwn is not a function.

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 29, 2023
@blechatellier
Copy link
Author

I have fixed it creating my own polyfill

if (!Object.hasOwn) {
  Object.hasOwn = (obj, prop) =>
    Object.prototype.hasOwnProperty.call(obj, prop);
}

@github-actions

This comment has been minimized.

@ChristianMurphy
Copy link
Member

Welcome @blechatellier! 👋
Sorry you ran into a spot of trouble.

react-markdown targets the V8 runtime of Node's long term release.
Currently Node 16, with support for ECMA2022, at the time of writing.

If you'd like to support older runtimes, either in browser or in node.
Use @babel/preset-env to transpile syntax features and polyfill globals to match the specific environment you need to support.

The intent of react-markdown is to offer a fast, modern, idiomatic library.
Allowing adopters to transpile and polyfill only what is needed on their project, rather than forcing transpilation and polyfills on all several million projects leveraging react-markdown, most of whom do not need most, if any, of them.

Feel free to reach out in discussions if you have questions or concerns https://github.com/orgs/remarkjs/discussions

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2023
@ChristianMurphy ChristianMurphy added the 🙋 no/question This does not need any changes label Sep 29, 2023
@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Sep 29, 2023
@blechatellier
Copy link
Author

Thanks for taking the time to reply @ChristianMurphy completely understand keeping support current.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants