Open sjmcdowall opened 3 years ago
Hey there. So I'm not a TypeScript user, so I have no idea about what does and doesn't work regarding the way TypeScript works.
I think that I've probably gone full JS when creating this library and not really paid too much attention to keeping variables strictly of one type. What that means is that you'd have to declare your own types perhaps, or perhaps somebody could clean up the project / export typings for it. I just don't know!
Sorry I can't be of more help :)
I am not a TS guru either -- but it does seem like having a type definition file would be a good idea. i did a few of them a few years ago -- but rusty as heck now :)
Lets find a TS guru to do the grunt work for us :dagger: !
I think if we republish this library within SvelteKit, it'll generate type definitions for us :partying_face:
I think it's because center accepts a number array type as described on the error log. Therefore you should make center an array, like
let center = [ -80.2442, 36.0999];
Mapbox for some reason needs longitude as first element of the array too, I hope this helps.
So I finally have a simple map going (yay!) -- but I am using SvelteKit -- and it has TypeScript on by default (or at least this project does) -- and besides VS Code complainign about a bunch of things in Map itself it does like:
It is also complaining in my Svelte component about the usage of the {center} arg. I have, as per the example:
let center = { lat: 36.0999, lng: -80.2442 };
And use it thusly:
The error / warnring message I am getting is:
Type '{ lat: number; lng: number; }' is not assignable to type 'number[]'.
Just wondering if anyone has an idea about this -- the app actually works and renders a map -- so -- it's obviously not fatal but .. just trying to learn TS (I think)..
TIA!
/Steve