Unset values default to null #1769
Labels
breaking-changes
Introducing new BREAKING CHANGES
enhancement
New feature or request
question
Further information is requested
Describe the feature
When defining a Pinia ORM model in TypeScript, optional fields must be typed as
field: type | null
because thesave
method of Pinia ORM repos converts unset values (null, undefined) to null.However, the usual TypeScript way is declaring an optional field as
field?: type
, which treats an unset value as undefined. Furthermore, TypeScript's optional chaining (a?.b?.c
) and utility types (Required<T>
,Partial<T>
, etc.) also revolve around the undefined value.My proposition is to replace the usage of null for unset values with undefined. This seems fairly easy and is rather a matter of acceptance by/relevance to the project.
Additional information
Final checks
The text was updated successfully, but these errors were encountered: