(TypeScript developers might want to look away now…) 

So apparently ESM doesn’t like it when you change the type of an object by resolving to a different type from a promise returned from the constructor…

(Hey, don’t judge me, I have my reasons. And yes, they’re niche.) :P

Follow

(TypeScript developers might want to look away now…) 

(So in case you’re wondering the resolved datatype is a proxy to the datatype. Previously, I was returning this from the synchronous constructor but since dynamic imports are asynchronous, my constructor needs to be also now. And when the promise tries to resolve, that’s when Node throws its exception. Fun times!) :)

· · Web · 1 · 1 · 1

(TypeScript developers might want to look away now…) 

Hmm, no, it’s not that. Just created a basic spike to test just that and ESM is perfectly happy if you return a promise from a constructor that eventually resolves to a different datatype. So it must be something else that’s triggering it. With the stack traces were more helpful.

(TypeScript developers might want to look away now…) 

(Also, I just checked and it’s not something specific to when the datatype your promise from the constructor resolves to is a proxy. That also works in isolation.)

🤔

(TypeScript developers might want to look away now…) 

So fuck me, you know what it was? I got the fucking order of response and reject wrong in the arguments of the Promise() constructor *AGAIN*

:awesome: 👍

*smh*

Sign in to participate in the conversation
Aral’s Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!