1

How do I extend an interface or class on variable declaration?

For example:

export declare abstract class DynamicFormControlModel implements DynamicPathable {
    asyncValidators: DynamicValidatorsConfig | null;
    _disabled: boolean;
    disabledUpdates: Subject<boolean>;
    errorMessages: DynamicValidatorsConfig | null;
    hidden: boolean;
    id: string;
    label: string | null;
    labelTooltip: string | null;
    controlTooltip: string | null;
    layout: DynamicFormControlLayout | null;
    name: string;
    parent: DynamicPathable | null;
    relation: DynamicFormControlRelationGroup[];
    updateOn: FormHooks | null;
    validators: DynamicValidatorsConfig | null;
    abstract readonly type: string;
    protected constructor(config: DynamicFormControlModelConfig, layout?: DynamicFormControlLayout | null);
    disabled: boolean;
    readonly hasErrorMessages: boolean;
    toJSON(): Object;
}

model: DynamicFormControlModel extend {value:string}
  • model: DynamicFormControlModel extend {value:string} returns error
  • I know I could extend {value: string} or include "value" on the class itself, but I'm not looking for this answer.

1 Answer 1

1

You can use an intersection type:

let model: DynamicFormControlModel & {value:string};
Sign up to request clarification or add additional context in comments.

1 Comment

Hi @MattMcCutchen, thanks for your answer. i'd been searching for an hour and your answer solve my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.