From 7b349b9312a378bf493c53596cb7a8cf847b77eb Mon Sep 17 00:00:00 2001 From: PhilippMDoerner Date: Thu, 12 Dec 2024 13:25:55 +0100 Subject: [PATCH] Improve formly typing --- src/app/_models/formly.ts | 39 +++++----- .../formly/formly-service.service.ts | 74 ++++++++++--------- .../location-create-update-page.component.ts | 5 +- .../quote-field/quote-field.component.ts | 5 +- 4 files changed, 68 insertions(+), 55 deletions(-) diff --git a/src/app/_models/formly.ts b/src/app/_models/formly.ts index ff5e0cdf3..e3f8c4fb8 100644 --- a/src/app/_models/formly.ts +++ b/src/app/_models/formly.ts @@ -10,8 +10,8 @@ export interface FormlyPasswordInterface { disabled?: boolean; } -export interface FormlyInterface { - key: string; +export interface FormlyInterface { + key: Exclude; label?: string; required?: boolean; hide?: boolean; @@ -23,13 +23,14 @@ export interface FormlyInterface { showWrapperLabel?: boolean; } -export interface FormlyOverviewSelectConfig extends FormlyInterface { - labelProp: keyof T; - valueProp?: keyof T; - sortProp?: keyof T; +export interface FormlyOverviewSelectConfig + extends FormlyInterface { + labelProp: keyof Option; + valueProp?: keyof Option; + sortProp?: keyof Option; sortDirection?: 'asc' | 'desc'; campaign?: string; - options$: Observable; + options$: Observable; } export type DisabledFunction = ( @@ -39,16 +40,16 @@ export type DisabledFunction = ( control: AbstractControl, ) => Observable; -export interface FormlyOverviewDisabledSelectConfig - extends FormlyOverviewSelectConfig { - disabledExpression: DisabledFunction; +export interface FormlyOverviewDisabledSelectConfig + extends FormlyOverviewSelectConfig { + disabledExpression: DisabledFunction