Skip to content

Why set implicit defaults? #10

@ThaNarie

Description

@ThaNarie

While I love this library, I wonder why there was chosen to set implicit defaults for a lot of types.
This creates a difference between:

foo: String
foo: VueTypes.string

They are both optional, but one has a value of undefined where the other is "". Due to this it's not possible to check if someone passed an empty string or omitted the property.

When using this lib, I'd like to just use it everywhere to be consistent, but now I have to revert back to using the native option for optional properties that don't have a default set.

It also requires some extra changes when switching between required and optional property definitions.

There might be a valid reason for this that I'm overseeing, but otherwise I'd suggest to keep the default to undefined by default, and optionally add another modifier to execute the current behaviour.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions