@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
Functions
Interfaces
Type Aliases
Type Aliases
AnyFunction
Array
Type for immutable array
Type parameters
- Item
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
Int
Integer value
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
ObjectLike
A type representing non primitive values. This includes :
- symbol
- object (null is excluded)
- function
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
Radix36
Number parsing/formatting radix
For example this can be used for a strict use of parseInt
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