@w5s/core-type
W5S Core type modules (@w5s/core-type)
Installation
npm install @w5s/core-type
Usage
Example
import type { Nullable } from '@w5s/core-type';
export function someFunction(_input: Nullable<number>) {}
License
MIT © Julien Polo julien.polo@gmail.com
Index
Type Aliases
AnyFunction
Awaitable
Type for something that can be used with await
.
It can be either T
or Promise<T>
Type parameters
- T
Day
Day of the month
EmptyObject
Empty object type
ExpectAssertion
Hour
An hour of the day
JSONArray
Array of JSONValue
JSONObject
Record of JSONValue
JSONPrimitive
Any JSON primitive
- null
- boolean
- number
- string
JSONValue
Any valid JSON value
Minute
Minute of an hour
Month
Month of the year
Nullable
A type that can be either undefined
, null
, or T
Type parameters
- T = never
PartialKeys
Return a partial type of T
for keys in Keys
Type parameters
- T
- Keys: keyof T
Pretty
Flatten the type. Useful for IDE information.
Type parameters
- T
Primitive
Primitive values are immutable data at the lowest level of the language.
There are 7 primitive types
- string
- number
- symbol
- bigint
- boolean
- null
- undefined
RequiredKeys
Make specified Keys
properties in T
required
Type parameters
- T
- Keys: keyof T
Second
Second of a minute
Tag
Enhance Base
by adding tags. Every tag is prefixed by @@
as a convention to never be used by runtime code
Type parameters
- T: string | symbol
- Value = true
ValueOf
Extract all values from the keys Keys
of T
. If Keys
is omitted, all keys are used.
Type parameters
- T
- Keys: keyof T = keyof T
Year
Year number
A function that takes any kind of parameters and returns anything