Skip to content

Extend properties

Regle offers a way to extend the default validation properties with defineRegleConfig.

For more information about global config check here

Extending field properties

ts
import {  } from '@regle/core';

const {  } = ({
  : {
    : {
      : () => ..?. ?? false;
    }
  }
});

const {  } = ({ : '' }, {
  : {
    
  }
})

..$isRe

Extending nested object properties

ts
import {  } from '@regle/core';

const {  } = ({
  : {
    : {
      : () => .(.). === 0;
    }
  }
});

const {  } = ({ : {} } as { : { ?: string, ?: string } }, {
  : {
    : {}
  }
})

..$is

Extending collections properties

ts
import {  } from '@regle/core';

const {  } = ({
  : {
    : {
      : () => .. === 0;
    }
  }
});

const {  } = ({ : [{ : '' }] }, {
  : {
    : {
      : {  }
    }
  }
})

..$is

Typing shortcuts in component props

When defining shortcuts, it can be hard to type props in common Input components. For this Regle provides a type helper that can ease the declaration of these props.

ts
import {  } from '@regle/core';
export const { :  } = ({
  : {
    : {
      : () => true,
    },
  },
});
vue
<script lang='ts' setup>
import type {  } from '@regle/core';
import {} from './config'

const  = <{
  : <typeof , string, 'required'>;
  : string;
}>();

..
</script>

Released under the MIT License. Logo by Johannes Lacourly