Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing type parameter constraints #2028

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

Rugvip
Copy link
Contributor

@Rugvip Rugvip commented Mar 27, 2023

There's an issue with the type declarations in newer versions of TypeScript where the checking is a bit stricter. These typedefs need their type parameters constrained, or you will see the following errors:

node_modules/photoswipe/dist/types/gestures/tap-handler.d.ts:5:65 - error TS2344: Type 'T' does not satisfy the constraint 'string'.

5 export type AddPostfix<T, P> = import('../types.js').AddPostfix<T, P>;
                                                                  ~

  node_modules/photoswipe/dist/types/gestures/tap-handler.d.ts:5:24
    5 export type AddPostfix<T, P> = import('../types.js').AddPostfix<T, P>;
                             ~
    This type parameter might need an `extends string` constraint.

node_modules/photoswipe/dist/types/lightbox/lightbox.d.ts:16:77 - error TS2344: Type 'T' does not satisfy the constraint 'keyof PhotoSwipeEventsMap'.

16 export type EventCallback<T> = import('../core/eventable.js').EventCallback<T>;
                                                                               ~

  node_modules/photoswipe/dist/types/lightbox/lightbox.d.ts:16:27
    16 export type EventCallback<T> = import('../core/eventable.js').EventCallback<T>;
                                 ~
    This type parameter might need an `extends keyof PhotoSwipeEventsMap` constraint.

node_modules/photoswipe/dist/types/photoswipe.d.ts:16:76 - error TS2344: Type 'T' does not satisfy the constraint 'keyof PhotoSwipeEventsMap'.

16 export type EventCallback<T> = import('./core/eventable.js').EventCallback<T>;
                                                                              ~

  node_modules/photoswipe/dist/types/photoswipe.d.ts:16:27
    16 export type EventCallback<T> = import('./core/eventable.js').EventCallback<T>;
                                 ~
    This type parameter might need an `extends keyof PhotoSwipeEventsMap` constraint.

node_modules/photoswipe/dist/types/photoswipe.d.ts:20:78 - error TS2344: Type 'T' does not satisfy the constraint 'keyof PhotoSwipeEventsMap'.

20 export type AugmentedEvent<T> = import('./core/eventable.js').AugmentedEvent<T>;
                                                                                ~

  node_modules/photoswipe/dist/types/photoswipe.d.ts:20:28
    20 export type AugmentedEvent<T> = import('./core/eventable.js').AugmentedEvent<T>;
                                  ~
    This type parameter might need an `extends keyof PhotoSwipeEventsMap` constraint.

@dimsemenov dimsemenov merged commit d3482fe into dimsemenov:master Mar 29, 2023
@dimsemenov
Copy link
Owner

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants