Type

NarrowFields

@ng-forge/dynamic-forms

Narrow each field in an array based on its type property. Use with satisfies to get proper type inference for field arrays.

Signature

type NarrowFields = readonly NarrowField<RegisteredFieldTypes>[];

Examples

const fields = [
  { type: 'input', key: 'name', value: '', props: { type: 'text' } },
  { type: 'select', key: 'country', value: 'us', options: [...] },
] as const satisfies NarrowFields;