@form-guardian/shared-types

v1.0.5

Published

Shared TypeScript types and interfaces for Form Guardian packages. Internal package used by other @form-guardian packages.

Readme

@form-guardian/shared-types

Shared TypeScript types and interfaces for Form Guardian packages.

Overview

This package contains common TypeScript type definitions used across all Form Guardian packages. It's an internal package that ensures type consistency between @form-guardian/core, @form-guardian/dom, and @form-guardian/react.

Installation

npm install @form-guardian/shared-types

Exports

Types

  • FormId - Unique identifier for a form (string)
  • FormFieldData - Structure for form field data
  • FormDraft - Complete form draft structure
  • DraftData<T> - Draft data with values, timestamps, and metadata
  • DraftStorage - Interface for draft storage implementations
  • DraftValues - Record of field values (string | number | boolean)
  • FieldValue - Union type for field values

Interfaces

  • FormAutosaveOptions<T> - Options for form autosave configuration
  • UseFormAutosaveReturn<T> - Return type of useFormAutosave hook
  • UseDraftStatusOptions - Options for useDraftStatus hook
  • UseDraftStatusResult - Return type of useDraftStatus hook

Usage

This package is primarily used internally by other Form Guardian packages. If you're building a custom integration, you may import types from this package:

import type { FormId, DraftData, FormAutosaveOptions } from '@form-guardian/shared-types';

Note

This is an internal package. For most use cases, you should use:

  • @form-guardian/dom - for universal DOM-based autosave
  • @form-guardian/react - for React-specific hooks