@pegzkit/types
v0.0.3
Published
pegzkit TypeScript 类型工具包(纯类型层,无运行时产物)
Downloads
108
Maintainers
Readme
@pegzkit/typess
中文
@pegzkit/typess 是 pegzkit 的 TypeScript 类型工具子包。纯类型层,无任何运行时产物,零依赖。
安装
pnpm add -D @pegzkit/types使用方式
import type { Arrayable, DeepKeyof, Range } from "@pegzkit/types";类型列表
| 类型 | 说明 |
| --------------------- | ------------------------------------ |
| Arrayable<T> | T 或 T[] |
| DeepKeyof<T> | 深层键路径(点分隔字符串) |
| PropertyKey | 增强版 PropertyKey(含模板字面量) |
| Range<Min, Max> | 整数范围联合类型 |
| Literal<T> | 保留字面量类型 |
| SetPath<T, Path, V> | 深层路径赋值后的类型 |
| IsAny<T> | 判断是否为 any |
| IsPromise<T> | 判断是否为 Promise |
| Assert<T, U> | 断言类型相等 |
| IsProp<T, K> | 判断键是否存在于对象 |
English
@pegzkit/typess is the TypeScript type utility sub-package of pegzkit. Type-only, no runtime output, zero dependencies.
Installation
pnpm add -D @pegzkit/typessUsage
import type { Arrayable, DeepKeyof, Range } from "@pegzkit/typess";Type List
| Type | Description |
| --------------------- | --------------------------------------------------- |
| Arrayable<T> | T or T[] |
| DeepKeyof<T> | Deep key path (dot-separated string) |
| PropertyKey | Enhanced PropertyKey (includes template literals) |
| Range<Min, Max> | Integer range union type |
| Literal<T> | Preserve literal type |
| SetPath<T, Path, V> | Type after deep path assignment |
| IsAny<T> | Check if type is any |
| IsPromise<T> | Check if type is Promise |
| Assert<T, U> | Assert types are equal |
| IsProp<T, K> | Check if key exists on object |
