PsyTask | API Docs
    Preparing search index...

    Function defaultProps

    • Define default props in setup

      Type Parameters

      • T extends LooseObject
      • U extends Partial<T>

      Parameters

      • props: T
      • defaults: U

      Returns Merge<T, U>

      const setup = (props: { a?: number; b?: string }) => {
      const p = defaultProps(props, { a: 1, b: 'default' });
      // p.a is number, p.b is string
      return '';
      };