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 #37

Closed
danielkcz opened this issue Jan 31, 2019 · 10 comments
Closed

TypeScript #37

danielkcz opened this issue Jan 31, 2019 · 10 comments
Assignees

Comments

@danielkcz
Copy link
Contributor

danielkcz commented Jan 31, 2019

So in #18 you have a TypeScript mentioned in the roadmap, but what it actually means for you? In my experience, it's just a bad idea to have typings made manually. It always gets desynchronized. What is your opinion on that?

Besides, when I saw there is a Babel Polyfill requirement, I got real goosebumps. Haven't seen that for a while. I certainly don't want to enlarge app bundle with this monstrosity. If the package would be written in TypeScript, I believe this requirement could be removed as TSC is more than capable of production ES5 compatible code without any hiccups.

@uriklar
Copy link
Collaborator

uriklar commented Jan 31, 2019

Hi @FredyC
Regarding the babel requirement. I just did some checking up on that and it seems that this is resolved in the latest version (@react-google-maps/api v1.0.3). I just want to verify it with a couple more people before removing it from the docs.

Regarding Typescript. I guess this issue is a good place to talk about the plan. I personally use Typescript heavily in my projects and would just prefer to "re-write" the lib using typescript. But I know not everyone on the team might be on that same page.

@JustFly1984
Copy link
Owner

@uriklar If you can rewrite whole lib to typescript, I wouldn't mind)

@danielkcz
Copy link
Contributor Author

danielkcz commented Jan 31, 2019

Ok, I may dive into that next week in theory.

Do you have some experience with mixing propTypes and TypeScript? In our apps, we are using TS only. For a lib, it definitely makes sense to have both as JS consumers would be left out in the wind otherwise. There surely must be some effective way how to cover this without duplicating it for both worlds.

@JustFly1984
Copy link
Owner

@FredyC @uriklar I've extracted propTypes to single separate file, so it could be used to transform to types declarations.

@danielkcz
Copy link
Contributor Author

@JustFly1984 Do you have some tool for that? I was trying to look for one but wasn't lucky.

@JustFly1984
Copy link
Owner

@FredyC I do not know any tool to convert propTypes to typescript. I've just gother all proptypes in single file, co it could be useful to create types 1 to 1.

@uriklar
Copy link
Collaborator

uriklar commented Feb 1, 2019

I think we can pretty much base all our typings on:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/googlemaps/index.d.ts

With a bit of extending. I've started working on a POC. I'll link the branch here when it's ready

@uriklar
Copy link
Collaborator

uriklar commented Feb 2, 2019

Pushed https://github.com/JustFly1984/react-google-maps-api/compare/typescript

Right now it's a POC using the google maps types. Works nicely with the Circle component. Now just need to refactor all remaining components and define their interfaces

@uriklar
Copy link
Collaborator

uriklar commented Feb 4, 2019

@FredyC I created a PR for the Typescript re-write. I'd be happy if you could review it:
#41

@danielkcz
Copy link
Contributor Author

@uriklar Thank you for such an amazing pile of work. I got rather swamped with other stuff, so I was unable to watch it through.

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

3 participants