adamjkb / bark

Materialized path extension for Prisma
https://prisma-extension-bark.gitbook.io
MIT License
33 stars 5 forks source link

Types don't work when using ESNext, NodeNext #78

Closed Nedi11 closed 2 months ago

Nedi11 commented 3 months ago

Typescript types don't work when using ESNext or NodeNext module resolution.

adamjkb commented 3 months ago

Hi,

Could you provide a minimum reproduction of the issue. Or package.json & jsconfig.json so there is a bit more to go on.

Thanks!

Nedi11 commented 3 months ago

Hi,

Could you provide a minimum reproduction of the issue. Or package.json & jsconfig.json so there is a bit more to go on.

Thanks!

Here you go: https://codesandbox.io/p/devbox/red-snow-4qt6qv

adamjkb commented 2 months ago
image

I downloaded the files from the sandbox and ran npm install and for me the types are showing up correctly. I noticed that you might be using yarn. I never used yarn but it seems possible that it somehow messes with typescript's module resolution and it has to run in cjs mode.

This library is fairly minimal and the apart from creating a cjs bundle is written in "vanilla" ESM. So it should be straight forward to modify the package.json in the node_modules folder. Let me know if you can make it work, I'm happy to accept a PR that would appease yarn.

(As a side note: I did base Bark's type strategy on prisma extension accelerate. So I would be curious if it works for that but not this what the difference is)

Nedi11 commented 2 months ago

I am using NPM. I was talking about for e.x in prisma.node.createRoot(), "createRoot()" doesn't show on prisma.node I wasn't talking about return types

pincman commented 2 months ago

我正在使用 NPM。我说的是 prisma.node.createRoot() 中的 e.x,“createRoot()”没有显示在 prisma.node 上我不是在谈论返回类型

+1