misc: Add Nullable<T> helper type

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-01-21 11:18:41 +00:00
parent 0505c0f976
commit d1e1297f6d
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
2 changed files with 3 additions and 2 deletions

View File

@ -10,8 +10,7 @@ export interface CheckIntOptions {
const ENV_VAR_KEY_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
const LABEL_NAME_REGEX = /^[a-zA-Z][a-zA-Z0-9\.\-]*$/;
type NullableString = string | undefined | null;
type NullableLiteral = number | NullableString;
type NullableLiteral = Nullable<number | string>;
/**
* checkInt

2
typings/global.d.ts vendored
View File

@ -5,3 +5,5 @@ interface Dictionary<T> {
interface Callback<T> {
(err?: Error, res?: T): void;
}
type Nullable<T> = T | null | undefined;