-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improved the nws client algorithm to receive data from differen…
…t observations
- Loading branch information
1 parent
2b2efd7
commit d2d5171
Showing
4 changed files
with
72 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
export interface IWeatherData { | ||
dewPoint: IDewPoint; | ||
humidity: IRelativeHumidity; | ||
temperature: ITemperature; | ||
conditions: IConditions; | ||
export enum IWeatherUnits { | ||
C = 'C', | ||
F = 'F', | ||
percent = 'percent', | ||
string = 'string', | ||
} | ||
|
||
export interface ITemperature { | ||
value: number; | ||
unit: 'C' | 'F'; | ||
export enum IWeatherKey { | ||
dewPoint = 'dewPoint', | ||
humidity = 'humidity', | ||
temperature = 'temperature', | ||
conditions = 'conditions', | ||
} | ||
|
||
export interface IRelativeHumidity { | ||
value: number; | ||
unit: 'percent'; | ||
export interface IWeatherData { | ||
[IWeatherKey.dewPoint]: IDewPoint; | ||
[IWeatherKey.humidity]: IRelativeHumidity; | ||
[IWeatherKey.temperature]: ITemperature; | ||
[IWeatherKey.conditions]: IConditions; | ||
} | ||
|
||
export interface IDewPoint { | ||
value: number; | ||
unit: 'C' | 'F'; | ||
export type IBaseWeatherProperty<T, U extends IWeatherUnits> = { | ||
value: T; | ||
unit: U | keyof typeof IWeatherUnits; | ||
} | ||
|
||
export interface IConditions { | ||
value: string; | ||
unit: 'string'; | ||
} | ||
export type IRelativeHumidity = IBaseWeatherProperty<number, IWeatherUnits.percent>; | ||
export type IDewPoint = IBaseWeatherProperty<number, IWeatherUnits.C | IWeatherUnits.F>; | ||
export type IConditions = IBaseWeatherProperty<string, IWeatherUnits.string>; | ||
export type ITemperature = IBaseWeatherProperty<number, IWeatherUnits.C | IWeatherUnits.F>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters