-
Notifications
You must be signed in to change notification settings - Fork 61
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
Annoying TS error when using Map #46
Comments
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 🗡️ ! |
I think if we republish this library within SvelteKit, it'll generate type definitions for us 🥳 |
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 Mapbox for some reason needs longitude as first element of the array too, |
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
The text was updated successfully, but these errors were encountered: