JSPM

  • Created
  • Published
  • Downloads 924
  • Score
    100M100P100Q109664F
  • License BSD-3-Clause

TypeScript utilities

Package Exports

  • @flex-development/tutils
  • @flex-development/tutils/package.json

Readme

tutils

npm module type: cjs+esm license conventional commits github actions typescript vitest yarn

TypeScript utilities.

Contents

What is this?

This package contains TypeScript utilities used by the Flex Development (FLDV) team.

It includes enums, interfaces, 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 }