Skip to content

Problem (Error) with addFilter('thumbEl'... function and typescript #2178

Description

@ilant

Hi, there is an error with the lightbox.addFilter('thumbEl'... function
(i used the example code from this page - https://photoswipe.com/data-sources/#separate-dom-and-data)

Here is the error message:
Argument of type '(thumbEl: HTMLElement | null | undefined, data: SlideData, index: number) => HTMLElement | null | undefined' is not assignable to parameter of type '(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement'.
Type 'HTMLElement | null | undefined' is not assignable to type 'HTMLElement'.
Type 'undefined' is not assignable to type 'HTMLElement'.ts

the addFilter() function doesnt allow null or undefined value to be returned. It always require the HtmlElement as return type.

Is there any way to solve it?

Thank you

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