Package containing the basic definitions for handling data types.
npm i @rolster/types
The package path must be added in the files
property in the tsconfig.json
file
{
"files": ["node_modules/@rolster/types/index.d.ts"]
}
Name | Description |
---|---|
Undefined<T> |
Allows to type a generic data with undefined value. |
Nulleable<T> |
Allows to type a generic data with nulleable value. |
Unknown<T> |
Allows to type a generic data with unknown value. |
// Variable can contain an string|undefined value
const value1: Undefined<string> = 'string' || undefined;
// Variable can contain an boolean|null value
const value2: Nulleable<boolean> = false || null;
// Variable can contain an number|unknown value
const value3: Unknown<number> = 1044 || unknown;
- Daniel Andrés Castillo Pedroza 🚀