OpenLayers and TypeScript?

ⅰ亾dé卋堺 提交于 2019-12-21 17:11:06

问题


I was wondering if anybody knows if there are any existing TypeScript definition files for OpenLayers (or if they are already in the making).

I tried parsing the OpenLayers source files myself and use the documentation comments to build a TypeScript definition file but to really make this work I would need a complete JavaScript parser that also understand the documentation syntax in OpenLayers (it uses NaturalDocs, http://naturaldocs.org) and I'm beginning to think that translating the info by hand is easier than writing such a parser :(.

So does anybody now of a similar project or has an idea how to accomplish the task of generating those TypeScript definition files?

Thanks in advance!


回答1:


I haven't seen any mention of an OpenLayers.d.ts file yet but there's a growing list of definition files being tracked over here.




回答2:


Today I have uploaded the definitions for OL 3.1.1 to Github: https://github.com/3x0dv5/ol3-typescript-definitions Feel free to use




回答3:


There is no definition file yet. I also thought about creating one but instead just resorted to using it via ambient variable declaration.




回答4:


This is not really an answer, but have you looked into closurets? https://github.com/teppeis/closure-ts It seems promising, however, I wasn't able to convert any ol3 js files. I will try to dig a bit deeper and let you know.




回答5:


Here is a link to TypeScript definition files for Openlayers.

OpenLayers Definitionfiles



来源:https://stackoverflow.com/questions/12785670/openlayers-and-typescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!