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 complain over types #35

Closed
technbuzz opened this issue Jun 17, 2020 · 8 comments
Closed

Typescript complain over types #35

technbuzz opened this issue Jun 17, 2020 · 8 comments

Comments

@technbuzz
Copy link

Any types available for this plugin? as I am getting following error
image

@maximeh
Copy link
Owner

maximeh commented Jun 17, 2020

Hey there,
Did you add bouncemarker.js to your file? The plugin will add the option to the marker class.
I don't use any IDE (I use vim); so I'm not sure what's going on there but it could be a setup issue?

@technbuzz
Copy link
Author

The plugins works fine, only that I don't get any intellisense in VSCode.

By the way, I can't imagine how do you work without the intellisense, do you always look the documentation or you add the api to your muscle memory?

@maximeh
Copy link
Owner

maximeh commented Feb 28, 2021

Yeah I basically have the browser on one desktop, and another with a terminal full screen and work in there. It's small enough that I'm pretty happy that way (I do use IDE for other bigger project, but that's small enough to work like that).
Did you figure it out in the end? Could I do something to help there?

@bhdzllr
Copy link
Contributor

bhdzllr commented Mar 2, 2021

Since @technbuzz uses TypeScript, the problem can be bypassed with the use of "as any" after the marker options. Of course a better solution so you don't loose type hints for all marker options would be to use type definitions.

This can be done with a file named "leaflet.bouncemarker.d.ts" and the following content. This works for me, I don't know if it is best practices or the common way to add options to an existing interface so I don't know if it is a good idea to include this in the repository:

import * as L from 'leaflet';

declare module 'leaflet' {

	export interface MarkerOptions extends InteractiveLayerOptions {

		bounceOnAdd?: boolean;

		bounceOnAddOptions?: {
			duration: number,
			height: number,
			loop: number
		};

		bounceOnAddCallback?: Function;

	}

}

@maximeh
Copy link
Owner

maximeh commented Mar 2, 2021

From what I'm reading it seems to make sense to add that file to the repo so it's there for whomever wanna use it, care to open a PR?

@bhdzllr
Copy link
Contributor

bhdzllr commented Mar 5, 2021

@maximeh Ok, I will open a pull request.

maximeh added a commit that referenced this issue Mar 5, 2021
Add TypeScript module definition file (#35)
@maximeh maximeh closed this as completed Mar 5, 2021
@programadorsalazarburgos
Copy link

programadorsalazarburgos commented Sep 17, 2021

cual es la solución a este problema

@maximeh
Copy link
Owner

maximeh commented Sep 17, 2021

I don't speak Spanish but you can use the latests release if you want to have that fixed:
https://github.com/maximeh/leaflet.bouncemarker/releases/tag/v1.2.1

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

No branches or pull requests

4 participants