1
0
Fork 0

src/types/misc: Add UnixTimestampMillis, Seconds, and Milliseconds

These should be moved into their own module at some point and provide
functions to convert between and to yield these types.
master
Mike Gerwitz 2019-10-22 16:51:40 -04:00
parent 5552de93d5
commit 2771cf2a71
1 changed files with 13 additions and 1 deletions

14
src/types/misc.d.ts vendored
View File

@ -38,12 +38,24 @@
type NominalType<K, T> = K & { __nominal_type__: T };
/** Unit of time in seconds */
type Seconds = NominalType<number, 'Seconds'>;
/**
* Unix timestamp
*
* Number of seconds since the Unix epoch (1970-01-01 UTC).
*/
type UnixTimestamp = NominalType<number, 'UnixTimestamp'>;
type UnixTimestamp = NominalType<Seconds, 'UnixTimestamp'>;
/** Unit of time in milliseconds */
type Milliseconds = NominalType<number, 'Milliseconds'>;
/** Unix timestamp represented in milliseconds */
type UnixTimestampMillis = NominalType<Milliseconds, 'UnixTimestampMillis'>;
/**