You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letobjDescriptor=getDescriptor(obj,accessName)letproto=Object.getPrototypeOf(obj)letprotoDescriptor=proto&&getDescriptor(proto,accessName)letoriginalDescriptor=objDescriptor||protoDescriptorassert(originalDescriptor||accessNameinobj,`${String(accessName)} does not exist`)
originalDescriptor will be undefined but accessName in obj is true.
Works good if I do const a = new A() instead, but this is not the point.
Describe the bug
I hope I gave the right title.
Problem
Consider the following:
with error:
TypeError: Cannot set property a of #<Foo> which has only a getter
.Looked at this function, and it this code:
originalDescriptor
will be undefined butaccessName in obj
istrue
.Works good if I do
const a = new A()
instead, but this is not the point.Solution
I've investigated it, and saw that the problem is within https://github.com/tinylibs/tinyspy
I've opened an issue there tinylibs/tinyspy#49 and suggested a fix: tinylibs/tinyspy#50
But the team is probably busy with more urgent stuff.
Reproduction
Check PR tinylibs/tinyspy#50 in https://github.com/tinylibs/tinyspy it has a test that will fail.
Also this: https://stackblitz.com/edit/vitest-dev-vitest-qxyq6eqp?file=src%2Fbasic.ts
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: