Package Exports
- @flex-development/tutils
- @flex-development/tutils/package.json
Readme
tutils
TypeScript utilities.
Contents
What is this?
This package contains TypeScript utilities used by the Flex Development (FLDV) team.
It includes enums, types, and type guards.
When should I use this?
Use this package when you need a variety of TypeScript utilities.
Note that although this project is publicly available, it is intended for mainly internal use.
Install
yarn add -D @flex-development/tutils
From Git:
yarn add -D @flex-development/tutils@flex-development/tutils
See Git - Protocols | Yarn for details on requesting a specific branch, commit, or tag.
Use
import type { Nullable, Path } from '@flex-development/tutils'
/**
* Object representing a `User` entity **(from the database)**.
*
* **Does not include any [virtual fields][1]**.
*
* [1]: https://sequelize.org/v7/manual/getters-setters-virtuals#virtual-fields
*/
interface IUser {
created_at: number
email: Lowercase<string>
id: number
name: { first: Nullable<string>; last: Nullable<string> }
updated_at: Nullable<number>
}
/** {@linkcode IUser} attributes. */
type UserAttribute = Path<IUser> // 'created_at' | 'email' | 'id' | 'name' | 'name.first' | 'name.last' | 'updated_at'
export type { IUser as default, UserAttribute }