david-plugge / typed-pocketbase

Add types to the PocketBase JavaScript SDK
MIT License
85 stars 10 forks source link

Support JSON values #8

Closed gBasil closed 1 year ago

gBasil commented 1 year ago

The json field type currently isn't supported and crashes the codegen. It would be nice to have even untyped support and marking the field (and potentially other currently untyped fields) as unknown.

david-plugge commented 1 year ago

Didn´t even notice i missed json.

I´d rather type json as any or

type Json = boolean | string | number | Json[] | { [K: string]: Json };

depending on how strict the types should be. It seems like you can even use Date and URL objects in json when using create or update. So i´d rather go with any for json type and unknown for unknown types.

david-plugge commented 1 year ago

Added support in version 0.0.4, thanks for reporting the issue

gBasil commented 1 year ago

The types for JSON values could potentially be defined on TypedPocketBase when initializing the type.