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 in Ionic 5 #40

Open
msacchetti opened this issue Sep 29, 2021 · 2 comments
Open

Typescript in Ionic 5 #40

msacchetti opened this issue Sep 29, 2021 · 2 comments

Comments

@msacchetti
Copy link

I followed the install instructions for typescript, and i cannot get it to work in Typescript.

npm install marker-animate-unobtrusive
npm install @types/googlemaps --save
npm install @types/marker-animate-unobtrusive --save

importing nothing, and trying to use it:

pin = new SlidingMarker()
Error: Cannot find name 'SlidingMarker'.ts(2304) any

Trying to import different ways:

import { SlidingMarker } from 'marker-animate-unobtrusive'
Error: /node_modules/@types/marker-animate-unobtrusive/index.d.ts' is not a module.ts(2306)
import { SlidingMarker } from 'SlidingMarker'
error: Cannot find module 'SlidingMarker' or its corresponding type declarations.ts(2307)
@msacchetti
Copy link
Author

I had to do this to get it to work in ionic 5 / TS

    const google = await loader.load()
    var SlidingMarker = require('marker-animate-unobtrusive')

@msacchetti
Copy link
Author

msacchetti commented Sep 30, 2021

Nevermind, typescript doesnt allow methods on it doing it that way.

 pin = new SlidingMarker({
      position: { lat: lat, lng: lng },
      map,
      duration: 0,
      easing: 'easeOutExpo',
      shape: { coords: [20, 20, 30], type: 'circle' },
      icon: {
        url: 'https://i.ibb.co/4tJxG6c/marker.png',
        size: new google.maps.Size(35, 35),
      },
      optimized: false,
    })

   pin.setDuration(1000)
  error: Property 'setDuration' does not exist on type 'Marker'.t

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

1 participant