patmood / pocketbase-typegen

Typescript generation for pocketbase records
https://www.npmjs.com/package/pocketbase-typegen
512 stars 16 forks source link

Project license / potential addition to pocketbase-typegen #85

Closed emmyarty closed 11 months ago

emmyarty commented 11 months ago

Hi, first off thanks for this lib, it's been a total boone developing for PB with it and I'm grateful it exists.

Something I kludged together for my own use initially but intend to share once a little more polished, complete, and tested is a function which uses the types to return an instance of PB where collections are accessible through dot notation and typed using your output.

I can see that since writing it something similar has been added to pb typegen, and I'm not sure the philosophy of your project would welcome something like this which technically affects runtime behaviour. If not was wondering whether you're fine with this being forked so I could release this separately instead?

It ends up working like this, invoking the pb constructor and returning a typed instance instead: Screenshot 2023-10-29 at 00 46 40

patmood commented 11 months ago

Yeah sure feel free to fork it. As mentioned in https://github.com/pocketbase/js-sdk/issues/152 there are low priority plans to have generated types in the official SDK eventually.

patmood commented 11 months ago

Generally I think it's better for a package do 1 thing (type generation in this case) and other packages like yours can build on top of it. Love seeing all the development around pocketbase DX!