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

typescript typings without namespace #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mac2000
Copy link

@mac2000 mac2000 commented May 26, 2020

Note that import svgPanZoom from 'svg-pan-zoom' will still work as usual so we are hopefully not breaking anything, but now you can import svgPanZoom, { Options, Instance } from "dist/svg-pan-zoom"; and use interfaces in you code instead of SvgPanZoom.Instance namespaced way which might cause problems in some scenarious

@mac2000
Copy link
Author

mac2000 commented May 26, 2020

Or, as alternative, if namespace is something desired we can try to leave it as is and just "reexport" interfaces, e.g.

before:

declare module "svg-pan-zoom" {
  export = svgPanZoom;
}

after:

export interface Options extends SvgPanZoom.Options {}
export interface CustomEventHandler extends SvgPanZoom.CustomEventHandler {}
export interface CustomEventOptions extends SvgPanZoom.CustomEventOptions {}
export interface Point extends SvgPanZoom.Point {}
export interface PointModifier extends SvgPanZoom.PointModifier {}
export interface Sizes extends SvgPanZoom.Sizes {}
export interface Instance extends SvgPanZoom.Instance {}

export default svgPanZoom;

which should also work, not sure which way you do prefer if any

@ariutta
Copy link
Collaborator

ariutta commented Mar 17, 2021

Thanks for the pull request! My job has shifted away from front end, so I unfortunately can't keep up with maintenance. Would you be interested in becoming a maintainer?

#395

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