timotejroiko / sweph

The definitive Swiss Ephemeris bindings for Node.js
Other
93 stars 15 forks source link

export types and interfaces #15

Closed iki closed 7 months ago

iki commented 7 months ago

Prevent TS errors like Exported variable '...' has or is using name 'Calc' from external module "sweph" but cannot be named.

timotejroiko commented 7 months ago

Hello, thank you for the PR.

Could you show an example of how/where this issue happens? I haven't seen it happen before.

iki commented 7 months ago

Hi, thanks for a great Node/TS sweph binding!

The interfaces and types are useful for reusing through the app that uses sweph.

TS complains whenever user exports some module method that either uses parameter or return value types that can't be imported. E.g. with Calc

export const getPosition = (body: Bodies, day: Date | number) =>
  swe.calc_ut(typeof day === 'number' ? day : getJulDay(day), SweBodies[body], 0)