Harmonize tsconfig for frontend and server.

This commit is contained in:
baldo 2022-09-14 16:33:43 +02:00
parent 894ee97fdf
commit 22bff3496a
30 changed files with 77 additions and 53 deletions

View file

@ -3,7 +3,7 @@
*
* @module arrays
*/
import { TypeGuard } from "./helpers";
import type { TypeGuard } from "./helpers";
/**
* Type guard for an array with elements of type `<Element>`.

View file

@ -9,8 +9,15 @@ import { isBoolean, isNumber, isString } from "./primitives";
import { isArray } from "./arrays";
import { isOptional } from "./helpers";
import { isJSONObject } from "./json";
import { Domain, isDomain, isSite, isUrl, Site, Url } from "./newtypes";
import { EmailAddress, isEmailAddress } from "./email";
import {
type Domain,
isDomain,
isSite,
isUrl,
type Site,
type Url,
} from "./newtypes";
import { type EmailAddress, isEmailAddress } from "./email";
/**
* Configuration for a single coordinate.

View file

@ -3,10 +3,10 @@
*/
import { toIsNewtype } from "./newtypes";
import { isNumber, isString } from "./primitives";
import { JSONObject } from "./json";
import type { JSONObject } from "./json";
import { toIsEnum } from "./enums";
import { SortFieldFor, toIsSortField } from "./sortfields";
import { UnixTimestampSeconds } from "./time";
import { type SortFieldFor, toIsSortField } from "./sortfields";
import type { UnixTimestampSeconds } from "./time";
/**
* An email address.

View file

@ -1,7 +1,7 @@
/**
* Contains type guards and helpers for enums.
*/
import { TypeGuard, ValueOf } from "./helpers";
import type { TypeGuard, ValueOf } from "./helpers";
/**
* Shorthand type alias for enum {@link TypeGuard}s.

View file

@ -2,21 +2,26 @@
* Contains types and type guards for monitoring data.
*/
import {
Domain,
type Domain,
isDomain,
isMAC,
isSite,
MAC,
Site,
type MAC,
type Site,
toIsNewtype,
} from "./newtypes";
import { isBoolean, isNumber, isString } from "./primitives";
import { toIsEnum } from "./enums";
import { Hostname, isHostname, isMapId, MapId } from "./node";
import { EmailAddress, isEmailAddress, isMailType, MailType } from "./email";
import { isUnixTimestampSeconds, UnixTimestampSeconds } from "./time";
import { type Hostname, isHostname, isMapId, type MapId } from "./node";
import {
type EmailAddress,
isEmailAddress,
isMailType,
MailType,
} from "./email";
import { isUnixTimestampSeconds, type UnixTimestampSeconds } from "./time";
import { isOptional } from "./helpers";
import { SortFieldFor, toIsSortField } from "./sortfields";
import { type SortFieldFor, toIsSortField } from "./sortfields";
/**
* Token for activating monitoring of a Freifunk node. This is being sent to verify the email address to use.

View file

@ -6,7 +6,7 @@
*
* Also holds newtype definitions that don't fit elsewhere.
*/
import { TypeGuard } from "./helpers";
import type { TypeGuard } from "./helpers";
import { isString } from "./primitives";
// =====================================================================================================================
@ -140,3 +140,15 @@ export type Domain = string & { readonly __tag: unique symbol };
* @param arg - Value to check.
*/
export const isDomain = toIsNewtype(isString, "" as Domain);
/**
* A search term entered by the user in the frontend.
*/
export type SearchTerm = string & { readonly __tag: unique symbol };
/**
* Type guard for {@link Domain}.
*
* @param arg - Value to check.
*/
export const isSearchTerm = isString;

View file

@ -3,25 +3,27 @@
*/
import { isObject } from "./objects";
import { isOptional } from "./helpers";
import {
import type {
Coordinates,
Domain,
FastdKey,
MAC,
Nickname,
Site,
} from "./newtypes";
import {
isCoordinates,
isDomain,
isFastdKey,
isMAC,
isNickname,
isSite,
MAC,
Nickname,
Site,
toIsNewtype,
} from "./newtypes";
import { isBoolean, isString } from "./primitives";
import { SortFieldFor, toIsSortField } from "./sortfields";
import { EmailAddress, isEmailAddress } from "./email";
import { isUnixTimestampSeconds, UnixTimestampSeconds } from "./time";
import { type SortFieldFor, toIsSortField } from "./sortfields";
import { type EmailAddress, isEmailAddress } from "./email";
import { isUnixTimestampSeconds, type UnixTimestampSeconds } from "./time";
import {
isMonitoringState,
isOnlineState,

View file

@ -1,9 +1,9 @@
/**
* Contains helper types and type guards for sort fields.
*/
import { Enum, toIsEnum } from "./enums";
import { type Enum, toIsEnum } from "./enums";
import { isString } from "./primitives";
import { TypeGuard } from "./helpers";
import type { TypeGuard } from "./helpers";
/**
* Generic untyped sort field.

View file

@ -5,12 +5,12 @@ import { toIsEnum } from "./enums";
import { isNullable } from "./helpers";
import { isPlainObject } from "./objects";
import { isBoolean, isNumber, isString } from "./primitives";
import { SortFieldFor, toIsSortField } from "./sortfields";
import { type SortFieldFor, toIsSortField } from "./sortfields";
import {
DurationSeconds,
type DurationSeconds,
isDurationSeconds,
isUnixTimestampSeconds,
UnixTimestampSeconds,
type UnixTimestampSeconds,
} from "./time";
// FIXME: Naming Task vs. Job