Skip to content

v5.0.1

Compare
Choose a tag to compare
@dwightjack dwightjack released this 23 Nov 07:00
· 217 commits to main since this release

Note: v5.0.0 has been skipped due to an internal bug. Please use v5.0.1 or above.

Breaking Changes

Default for booleans

bool().def(undefined) explicitly sets the default: undefined property on the type instead of removing it (#284):

const type = bool().def(true) //  { type: Boolean, default: true }

// vue-types@4
type.def(undefined)//  { type: Boolean }

// vue-types@5
type.def(undefined)//  { type: Boolean, default: undefined }

Nullable strict validation

nullable validates only when a prop value is === null. This change makes it easier to use it with other validators like oneOfType.

oneOfType and oneOf strict validation

When passed a oneOf validator, oneOfType checks the actual values instead of their types.

const type = oneOfType([oneOf(['auto', 'fit-content'] as const), Number]);

// vue-types@4
typeof type === string | number

// @vue-types@5
typeof type === 'auto' | 'fit-content' | number

This makes it easier to define complex validators mixing specific values and generic types.

Standalone Nuxt module

Nuxt support has been moved to a dedicated module: vue-types-nuxt including support for both Nuxt@2 and Nuxt@3. See the usage documentation here: https://dwightjack.github.io/vue-types/guide/installation.html#nuxt

Minor Changes

  • oneOf supports null as a value: oneOf(['on', 'off', null])
  • Support for union types in oneOf (#147)

Other Changes and Notes

  • Documentation migrated to VitePress.
  • Repository structure converted to an NPM monorepo.