Stronger types for unix timestamps
This commit is contained in:
parent
217ed6ff20
commit
c627e702ce
4 changed files with 22 additions and 9 deletions
server/types
|
@ -293,8 +293,12 @@ export type MAC = {
|
|||
};
|
||||
export const isMAC = toIsNewtype<MAC>(isString);
|
||||
|
||||
export type UnixTimestampSeconds = number;
|
||||
export type UnixTimestampMilliseconds = number;
|
||||
export type UnixTimestampSeconds = number & { readonly __tag: unique symbol };
|
||||
export type UnixTimestampMilliseconds = number & { readonly __tag: unique symbol };
|
||||
|
||||
export function toUnixTimestampSeconds(ms: UnixTimestampMilliseconds): UnixTimestampSeconds {
|
||||
return Math.floor(ms) as UnixTimestampSeconds;
|
||||
}
|
||||
|
||||
export type MonitoringToken = {
|
||||
value: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue