Skip to content

Type mismatch in dateFilter between NgxMatDatetimePickerInputV2 and base types #17

@keningfree

Description

@keningfree

Hi, thank you for your great work on this library!

I encountered a TypeScript error related to the dateFilter property in NgxMatDatetimePickerInputV2<D>. It seems the getter and setter definitions are not compatible with the base types NgxDateFilterFn<D> or NgxMatDatepickerControl<D>.

Angular: 20.3.7
@ngxmc/datetime-picker: 20.1.0

Here’s the error message:

TS2416: Property 'dateFilter' in type 'NgxMatDatetimePickerInputV2<D>' is not assignable to the same property in base type 'NgxDateFilterFn<D>'.
Type '(date: D) => boolean' is not assignable to type '(date: D | null) => boolean'.
'D' could be instantiated with an arbitrary type which could be unrelated to 'D | null'.

Would it be possible to update the type definition of dateFilter to accept D | null as the parameter type? For example:

get dateFilter(): (date: D | null) => boolean;
set dateFilter(value: (date: D | null) => boolean);

This would resolve the type incompatibility and align with the expected base type.

Thanks in advance!


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions