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.

Cannot assign to read only property 'Symbol(Symbol.hasInstance)' of function

See original GitHub issue

Hi! Thank you for all your work on this library.

I’m trying to use Tone.js on a project, which includes this library as a dependency. When I try to build my project using Babel I get the following error:

TypeError: Cannot assign to read only property ‘Symbol(Symbol.hasInstance)’ of function 'function AudioBuffer(options){if(nativeOfflineAudioContextConstructor===null){throw new Error(‘Missing the nati…<omitted>…;}’

I initially logged the issue in Tone.js’s repo, but I think the issue is actually here.

Babel seems to prefer defineProperty when assigning hasInstance, and crashes otherwise. Would you accept a Pull Request changing the Symbol.hasInstance assignments in audio-buffer-constructor.ts and periodic-wave-constructor.ts to use defineProperty instead?

Thanks,

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rileyjshawcommented, Dec 5, 2022

@chrisguttandin sorry for the delay; it’s taken me ages to get around to upgrading Gatsby to the latest version. This issue seems to be fixed now that Gatsby has moved to MDX v2 🎉 thanks for sticking with this, and for all the work you put into this library!

0reactions
chrisguttandincommented, Sep 30, 2022

Hi @rileyjshaw, do you know if this is still an issue? It looks like the Gatsby plugin meanwhile got an update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can I not assign Symbol.hasInstance onto a function?
The reason is because the property descriptor for Function.prototype[Symbol.hasInstance] has {writable: false} , which makes it not possible ...
Read more >
[0.18.1] TypeError: Symbol.hasInstance is read-only #1671
TypeError : Cannot assign to read only property 'Symbol(Symbol.hasInstance)' of function 'function(...o) { if (e.called = !0, e.
Read more >
Symbol.hasInstance - JavaScript - MDN Web Docs
The Symbol.hasInstance well-known symbol is used to determine if a constructor object recognizes an object as its instance.
Read more >
TypeError: Cannot assign to read only property 'Symbol ...
I have a React app that uses a Node.js express server for the API endpoints with MongoDB. The create-react-app starter project comes ...
Read more >
Customizing ES6 via well-known symbols - 2ality
In ECMAScript 6, the object Symbol has several properties that ... Given that this property is read-only, you can't use assignment to ...
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