Closed Andyradall closed 6 months ago
@Andyradall , Thanks for highlighting the issue with lightGallery and the lgMediumZoom plugin in TypeScript! It seems we missed the types for plugin-specific options like backgroundColor, margin, mediumZoom ..etc . Here's a quick fix you can try: extend LightGalleryAllSettings to include the missing properties (d.ts):
import 'lightgallery';
declare module 'lightgallery' {
interface LightGalleryAllSettings {
backgroundColor?: string;
// Include any other plugin-specific settings here
}
}
This workaround will help you avoid TypeScript errors for now. We're on it, and we'll include the complete types in our next release.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description
When using
lightGallery
with thelgMediumZoom
plugin in a SvelteKit project, specifying plugin-specific settings such asbackgroundColor
forlgMediumZoom
results in a TypeScript error. This is because thebackgroundColor
property does not exist in the typePartial<LightGalleryAllSettings>
, indicating that the type definitions do not currently supportlgMediumZoom
plugin options.Steps to reproduce
lightGallery
in a Svelte component with thelgMediumZoom
plugin.backgroundColor
option within thelgMediumZoom
plugin options.backgroundColor
does not exist in typePartial<LightGalleryAllSettings>
.Unfortunately, I cannot provide a live demo project, but I have included the relevant JS code and sample HTML markup below.
JS code that you use to initialize lightGallery
Sample HTML markup
Environment
Additional context
The issue seems to stem from incomplete type definitions for
lightGallery
settings, particularly when trying to configure options for plugins likelgMediumZoom
. This makes it challenging to uselightGallery
in TypeScript projects where type safety is a concern, especially in SvelteKit applications.