Closed aopheim closed 10 months ago
Thanks! I have started adding typing to the code lately, but haven't published it yet. This looks like a useful addition until I get the complete typings done (if I ever get there...).
Will have a closer look soon before merging this!
I see this PR has not been included in a npm package. Could you make a new version of the package including this code, or are you intentionally waiting so you can include something else as well?
Sorry about not circling back to this until now. I merged my type hints branch just now, which should hopefully provide more thorough type declarations (generated from jsdoc).
If you're still using ocad2geojson, feel free to give them a spin and see if they work for you. I will try to make a release on npm as soon as I've verified myself that they work as expected.
Cool! Will try to find time to give it a spin :) If you are currently working on this repo, I am in need of getting issue #25 sorted. I am building a tool to compare two ocad files to figure out what has changed between versions, but the diff check won't work if the object ids are not constant. Would be very thankful if #25 get solved :)
Cool! Will try to find time to give it a spin :) If you are currently working on this repo, I am in need of getting issue #25 sorted. I am building a tool to compare two ocad files to figure out what has changed between versions, but the diff check won't work if the object ids are not constant. Would be very thankful if #25 get solved :)
Comparing two OCAD files to figure out what has changed is a much much needed tool! I myself tried several times build such a tool but it was always too time-consuming... I hope it will be available for general public :-)
When importing ocad2geojson in my Angular app, the app won't compile, giving error TS7016: Could not find a declaration file for module 'ocad2geojson'. However, I am able to use ocad2geojson when running the app locally, with ng serve.
Adding a TypeScript declaration file (https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html) which defines and exports functions available in the ocad2geojson library. Added some types for the different options inputs to the functions as well, but might have missed some. I am currently only using the ocadToGeoJson function from your library so haven't tested the other functions. Returning type "any" for some of the more complex types. Should probably be more specific here. By adding the declaration file, you are now able to do
import { readOcad, ocadToGeoJson } from 'ocad2geojson';
in order to import specific functions from the library.Also added the FeatureCollection type from the 'geojson' library, as this makes it much easier to work with when knowing the structure of the return object. Adds a dependency to @types/geojson though, so up to you to consider if it is ok to include :)