Make typeguards for newtypes match the type instead of isString or isNumber.
This commit is contained in:
parent
f296c6fe26
commit
72543b95ee
3 changed files with 34 additions and 21 deletions
server/types
|
@ -3,6 +3,7 @@ import {
|
|||
Domain,
|
||||
DomainSpecificNodeResponse,
|
||||
EmailAddress,
|
||||
isNumber,
|
||||
JSONObject,
|
||||
MonitoringResponse,
|
||||
MonitoringState,
|
||||
|
@ -13,6 +14,7 @@ import {
|
|||
Site,
|
||||
StoredNode,
|
||||
toIsEnum,
|
||||
toIsNewtype,
|
||||
} from "./shared";
|
||||
|
||||
export * from "./config";
|
||||
|
@ -90,12 +92,13 @@ export function toMonitoringResponse(node: StoredNode): MonitoringResponse {
|
|||
};
|
||||
}
|
||||
|
||||
// TODO: Complete interface / class declaration.
|
||||
export type NodeSecrets = {
|
||||
monitoringToken?: MonitoringToken,
|
||||
};
|
||||
|
||||
export type MailId = number & { readonly __tag: unique symbol };
|
||||
export const isMailId = toIsNewtype(isNumber, NaN as MailId);
|
||||
|
||||
export type MailData = JSONObject;
|
||||
|
||||
export enum MailType {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue