gkjohnson / xacro-parser

Utility for parsing and converting ROS Xacro files in Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recently added cjs build breaks typescript users

defunctzombie opened this issue · comments

The change introduced in 565009d altered the package entry point. Without a types field in package.json, typescript tries to find the type definitions alongside the source files. The new entry point for main does not have type definitions alongside the source files.

One solution is to add a types field to package.json that points to an index.d.ts file. This would fix the problem as typescript prefers that field over trying to find .d.ts files next to the sources. This is a quick and fixed solution.

Another would be to port the code to typescript (largely just rename the files to .ts) and then use typescript to build an es6 and cjs version in each folder respectively. Each would have the the type definitions and also keep their original file layouts. We do this in the rosbag repo. The main benefit is you can drop babel, rollup, and manually maintained type definitions. But obviously more work now.

@defunctzombie thanks for the report! I just published v0.3.3 with the "types" field in the package.json -- let me know if something else needs updating!

Thanks for the quick turnaround! Can confirm this resolved issues using this module in a typescript project.