You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using lightGallery with the lgMediumZoom plugin in a SvelteKit project, specifying plugin-specific settings such as backgroundColor for lgMediumZoom results in a TypeScript error. This is because the backgroundColor property does not exist in the type Partial<LightGalleryAllSettings>, indicating that the type definitions do not currently support lgMediumZoom plugin options.
Steps to reproduce
Initialize lightGallery in a Svelte component with the lgMediumZoom plugin.
Attempt to set the backgroundColor option within the lgMediumZoom plugin options.
TypeScript error occurs indicating that backgroundColor does not exist in type Partial<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
import { onMount } from 'svelte';
import lightGallery from 'lightgallery';
import 'lightgallery/css/lightgallery.css';
import 'lightgallery/css/lg-medium-zoom.css';
import lgMediumZoom from 'lightgallery/plugins/mediumZoom';
<div class="attachLightGallery">
<!-- Images to be zoomed with lgMediumZoom -->
</div>
Environment
Browser and version: Arc 1.33.0 (Chromium-based)
lightGallery version: "^2.8.0-beta.1" and tested with "2.7.2" as well
SvelteKit version: "^2.5.0"
Additional context
The issue seems to stem from incomplete type definitions for lightGallery settings, particularly when trying to configure options for plugins like lgMediumZoom. This makes it challenging to use lightGallery in TypeScript projects where type safety is a concern, especially in SvelteKit applications.
The text was updated successfully, but these errors were encountered:
@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';declaremodule'lightgallery'{interfaceLightGalleryAllSettings{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.The text was updated successfully, but these errors were encountered: