Open akessner opened 8 years ago
I like this proposal, because I was missing typings for this repository and had to write them myself. Please consider this, @mourner.
Hi @akessner. Do you still have that TypeScript definition ? Thanks
Not @akessner, but this may be helpful for you. It is not complete though.
/// <reference path="../node/node.d.ts" />
interface SunlightTimes {
sunrise: Date;
sunriseEnd: Date;
goldenHourEnd: Date;
solarNoon: Date;
goldenHour: Date;
sunsetStart: Date;
sunset: Date;
dusk: Date;
nauticalDusk: Date;
night: Date;
nadir: Date;
nightEnd: Date;
nauticalDawn: Date;
dawn: Date;
}
interface SunPosition {
altitude: number;
azimuth: number;
}
interface MoonPosition {
altitude: number;
azimuth: number;
distance: number;
parallacticAngle: number;
}
interface MoonIllumination {
fraction: number;
phase: number;
angle: number;
}
interface MoonTimes {
rise: Date;
set: Date;
alwaysUp: boolean;
alwaysDown: boolean;
}
declare module 'suncalc' {
function getTimes(date: Date, latitude: number, longitude: number): SunlightTimes;
function getPosition(timeAndDate: Date, latitude: number, longitude: number): SunPosition;
function getMoonPosition(timeAndDate: Date, latitude: number, longitude: number): MoonPosition;
function getMoonIllumination(timeAndDate: Date): MoonIllumination;
function getMoonTimes(date: Date, latitude: number, longitude: number, inUTC?: boolean): MoonTimes;
}
Looks like some kind soul has published these: https://www.npmjs.com/package/@types/suncalc
However, it looks like it might not be up-to-date with the most recent API, e.g. it seems to be missing the recently-added altitude
argument to getTimes
(https://github.com/mourner/suncalc/issues/104).
Hi, I've made a suncalc TypeScript definition based on your latest version. I was wondering if you would like to add it to the official Typings repository? https://github.com/typings/registry
Details on the process: https://github.com/typings/typings/issues/322