News for hackers. Stuff that matters.
Re:Solidjs – JavaScript UI Library by nawgz on Tuesday November 30, 2021 @03:45PM (#29397255)
> > Well, certainly it should be clear that `obj !== {...obj}`, and you have to behave accordingly

> Sure but that's not my issue

I think you misunderstand what I'm saying. I know you know `obj !== {...obj}`, but it's important to understand exactly what that means, and one of those things to understand is

> when you copy an object [via destructuring], the latter object looses its prototype

For example, any class instance should most certainly not be used in that way, as it moves away from a true "object" paradigm (keys and values baby) into an inheritance paradigm, and as you observed inheritance is lost in destructuring.

> TypeScript doesn't warn you

I find this hard to believe. If you are passing TypeScript some interface T, and the object {...tInstance} doesn't have the keys of T, you should get an error. If you are passing TypeScript some class X, and you try to claim `typeof {...(xInstance)} === X` you would also surely see errors.

Please link an example so I can understand what I mean, I would guess you didn't type the destination very stringently so the loss of the class type was unobserved

Re:Solidjs – JavaScript UI Library by eatonphil on Tuesday November 30, 2021 @03:57PM (#29397370)
I can't reproduce what I'm saying! Well that's interesting. Thanks for pushing me.

I wonder what I was seeing in my code...

Re:Solidjs – JavaScript UI Library by nawgz on Tuesday November 30, 2021 @04:05PM (#29397442)
Cheers, good luck to figure it out.