Skip to content

Commit b70f9a8

Browse files
committed
Clean up some typescript issues
1 parent 57fd0fa commit b70f9a8

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/astronomy/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import coefficients from './coefficients.js'
33

44
export interface AstroValue {
55
value: number
6-
speed: number | null
6+
speed: number
77
}
88

99
export interface AstroData {
@@ -162,7 +162,7 @@ const astro = (time: Date): AstroData => {
162162
// in the more convenient unit of degrees per hour.
163163
const dTdHour = 1 / (24 * 365.25 * 100)
164164
Object.keys(polynomials).forEach((name) => {
165-
(result as any)[name] = {
165+
;(result as any)[name] = {
166166
value: modulus(polynomial(polynomials[name], T(time)), 360.0),
167167
speed: derivativePolynomial(polynomials[name], T(time)) * dTdHour
168168
}

src/constituents/constituent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const astronimicDoodsonNumber = (
3030
const astronomicSpeed = (astro: AstroData): number[] => {
3131
const results: number[] = []
3232
astronimicDoodsonNumber(astro).forEach((number) => {
33-
results.push(number.speed!)
33+
results.push(number.speed)
3434
})
3535
return results
3636
}

src/index.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,13 @@ export interface TidePrediction {
3838

3939
const tidePredictionFactory = (
4040
constituents: HarmonicConstituent[],
41-
options?: TidePredictionOptions
41+
options: TidePredictionOptions = {}
4242
): TidePrediction => {
4343
const harmonicsOptions = {
4444
harmonicConstituents: constituents,
4545
phaseKey: 'phase_GMT',
46-
offset: false as number | false
47-
}
48-
49-
if (typeof options !== 'undefined') {
50-
Object.keys(harmonicsOptions).forEach((key) => {
51-
if (typeof options[key as keyof TidePredictionOptions] !== 'undefined') {
52-
(harmonicsOptions as any)[key] =
53-
options[key as keyof TidePredictionOptions]
54-
}
55-
})
46+
offset: false as number | false,
47+
...options
5648
}
5749

5850
const tidePrediction: TidePrediction = {

0 commit comments

Comments
 (0)