Explicitly define allowness of undefined in schema
Is your feature request related to a problem? Please describe. When i get data from store i always need to manually check if it return value or undefined
Describe the solution you'd like Has ability to explicitly define if undefined is allowed in cell. So it will be correctly typed.
ie:
open: {type: ["boolean", "undefined"], default: false},
Describe alternatives you've considered
Each time i use validation on useRow or useTable - this is not very convenient
I'm not quite clear on what you are asking for. That you can indicate a cell might not be present? Or that you can have a default yet still a missing value? Or that the TypeScript definitions are wrong?
All are possible! Maybe show me an example of what you're having to do today that you don't like. Thanks!
I'm not quite clear on what you are asking for. That you can indicate a cell might not be present? Or that you can have a default yet still a missing value? Or that the TypeScript definitions are wrong?
All are possible! Maybe show me an example of what you're having to do today that you don't like. Thanks!
I have code like:
const assetData = store.getRow("assets", assetId);
if (!assetData) return
const {amount} = assetData // const amount: number | undefined
Though my schema is:
"assets": {
"amount": {
"type": "number"
},
...
So i expect typings to be number , not number | undefined
But sometimes I want the opposite: I want property to be optional(like it is now).
Currently i cant trust my DB if it is allowing "undefined" without any reason. I have to double-check everything each time i getting / setting values :(
I have to use zod-validation "wrapper" around tinyBase to check the values. This made tinyBase's own schema redundant.
I expect tinyBase to manage optional and mandatory properties with its own schema. Or, maybe get rid of its own schema and wrap it in zod(or other). At the beginning i did not expect tinyBase schema will have these limitations