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 support #1

Open
andi23rosca opened this issue Aug 3, 2020 · 13 comments
Open

Typescript support #1

andi23rosca opened this issue Aug 3, 2020 · 13 comments

Comments

@andi23rosca
Copy link

@DonNicoJs Maybe too early to start a conversation about it since you have just started the implementation, but would it make sense to write the whole codebase in Typescript?
Since Vue 3 will basically have better support for type checking especially in the templates.

@DonNicoJs
Copy link
Member

@andi23rosca I think is a good idea, but I am not as fluent in typescript as in javascript! What do you think if we first reach an alpha phase and then try to rewrite it? by using composition API it should be quite straightforward

@andi23rosca
Copy link
Author

@DonNicoJs Sounds good, I have just finished porting a large Vue codebase to Typescript so I think I can help when the time comes. It's nice that there's already types for Leaflet so we don't really need to do much work.

@lukkyjoe
Copy link
Contributor

hi, pardon me if I'm parachuting in with a non-valuable suggestion, but at work we have begun migrating some js codebases to ts using ts-migrate. results have been mostly positive.
so that is just to say that if for alpha you stick to js (which i totally understand it keeps things simpler and more narrowly scoped), there are tools that help you migrate later. don't have to feel like the window must be now.

@DonNicoJs
Copy link
Member

@lukkyjoe This is a very good input! Thank you! I will look into it

@DonNicoJs DonNicoJs added help wanted Extra attention is needed component and removed component help wanted Extra attention is needed labels Oct 3, 2020
@jsbroks
Copy link

jsbroks commented Oct 25, 2020

I definitely think typescript support is a must, since this is the direction Vue (and the community) is going.

@reinier-millo
Copy link

It can be added to use with typescript support and keep developing it as JS, you need to provide the module declaration file.

@reinier-millo
Copy link

reinier-millo commented Jan 8, 2021

I have to use it on one project and have added the following definition to my project

declare module '@vue-leaflet/vue-leaflet' {
  import type { DefineComponent } from 'vue';
  export const LMap: DefineComponent;
  export const LIcon: DefineComponent;
  export const LTileLayer: DefineComponent;
  export const LMarker: DefineComponent;
  export const LControlLayers: DefineComponent;
  export const LTooltip: DefineComponent;
  export const LPopup: DefineComponent;
  export const LPolyline: DefineComponent;
  export const LPolygon: DefineComponent;
  export const LRectangle: DefineComponent;
}

And it's working, but handling components as general (any) component.

@jsbroks
Copy link

jsbroks commented Feb 10, 2021

The solution mention above will only provide SOME typescript support. This will not add typing to components props.

@DonNicoJs I can go though and convert the files to typescript, but we should also conside removing the use of .vue files for better ts integration.

@ghost
Copy link

ghost commented Oct 5, 2021

Any news about typescript support ?

@leegee
Copy link

leegee commented Jul 6, 2022

Any news about typescript support? Lack thereof is making it hard/impossible to sell Vue with Leaflet.

@talentamaulana10
Copy link

where's the typescript support !?

@leegee
Copy link

leegee commented Sep 26, 2022

I switched to OpenLayers.

@aisiklar
Copy link

I have to use it on one project and have added the following definition to my project

declare module '@vue-leaflet/vue-leaflet' {
  import type { DefineComponent } from 'vue';
  export const LMap: DefineComponent;
  export const LIcon: DefineComponent;
  export const LTileLayer: DefineComponent;
  export const LMarker: DefineComponent;
  export const LControlLayers: DefineComponent;
  export const LTooltip: DefineComponent;
  export const LPopup: DefineComponent;
  export const LPolyline: DefineComponent;
  export const LPolygon: DefineComponent;
  export const LRectangle: DefineComponent;
}

And it's working, but handling components as general (any) component.

Hi Reinier-millo,
where did you create the above script in? I am really so unfamiliar to typescript but I want to use vue-leafler in an vue-electron template where the lang is ts...
Thanks in advance

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

8 participants