AlexLavoie42 / Nuxt-Mapbox

Elegant Mapbox integration with Nuxt
81 stars 11 forks source link

TypeScript error in `/components/DefaultPopup.vue:18:69 ` #22

Closed steklopod closed 1 year ago

steklopod commented 1 year ago

Steps to reproduce:

pnpm add vue-tsc

pnpm run nuxi typecheck
Снимок экрана 2023-05-22 в 21 26 58 Снимок экрана 2023-05-22 в 21 33 15 Снимок экрана 2023-05-22 в 21 28 34
AlexLavoie42 commented 1 year ago

For some reason typescript isn't realizing that popup can't be undefined here since we are calling popup.on first. This seems to work for me.

image

Could you let me know which version of TS you are using? Perhaps this is an issue with vue-tsc? My assumption is that the ?. syntax is what is breaking it.

For now I will wrap the whole thing in if (popup) which should hopefully fix the issue

AlexLavoie42 commented 1 year ago

I'm not able to reproduce the first error you showed in a fresh install either. Would you be able to try and reproduce the issue here?

image