@cutticat/types 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +127 -0
- package/dist/index.d.ts +396 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maksim Victorovich Fomin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @cutticat/types
|
|
2
|
+
|
|
3
|
+
TypeScript type library.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Quick start](#quick-start)
|
|
10
|
+
- [API](#api)
|
|
11
|
+
- [Documentation](#documentation)
|
|
12
|
+
- [Requirements](#requirements)
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
This library provides a set of useful TypeScript types for working with strings, objects, nullability, mutability, and HTTP. The types are optimized for strict TypeScript projects and provide compile-time type safety.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm i @cutticat/types
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import type {
|
|
28
|
+
ToCamelCase,
|
|
29
|
+
ToSnakeCase,
|
|
30
|
+
DeepReadonly,
|
|
31
|
+
FullyUndefinable,
|
|
32
|
+
PathParams,
|
|
33
|
+
} from "@cutticat/types"
|
|
34
|
+
|
|
35
|
+
// String transformations
|
|
36
|
+
type CamelCase = ToCamelCase<"hello-world"> // "helloWorld"
|
|
37
|
+
type SnakeCase = ToSnakeCase<"helloWorld"> // "hello_world"
|
|
38
|
+
|
|
39
|
+
// Working with objects
|
|
40
|
+
type ReadonlyConfig = DeepReadonly<{ name: string; age: number }>
|
|
41
|
+
type OptionalConfig = FullyUndefinable<{ name: string; age: number }>
|
|
42
|
+
|
|
43
|
+
// HTTP path parameters
|
|
44
|
+
type Params = PathParams<"/users/:id/posts/:postId"> // { id: string; postId: string }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### Strings
|
|
50
|
+
|
|
51
|
+
**Case conversion:**
|
|
52
|
+
|
|
53
|
+
- `ToCamelCase<S>` — converts to camelCase
|
|
54
|
+
- `ToSnakeCase<S>` — converts to snake_case
|
|
55
|
+
- `ToPascalCase<S>` — converts to PascalCase
|
|
56
|
+
- `ToKebabCase<S>` — converts to kebab-case
|
|
57
|
+
|
|
58
|
+
**Prefixes and suffixes:**
|
|
59
|
+
|
|
60
|
+
- `RemovePrefix<T, Prefix>` — removes a prefix
|
|
61
|
+
- `RemoveSuffix<T, Suffix>` — removes a suffix
|
|
62
|
+
|
|
63
|
+
**Utilities:**
|
|
64
|
+
|
|
65
|
+
- `ReplaceAll<S, From, To>` — replaces all occurrences of a substring
|
|
66
|
+
|
|
67
|
+
### Objects
|
|
68
|
+
|
|
69
|
+
- `PrefixKeys<T, Prefix>` — adds a prefix to all keys
|
|
70
|
+
- `KeysStartingWith<T, Prefix>` — keys starting with a prefix
|
|
71
|
+
- `Key` — any valid object key (`string | number | symbol`)
|
|
72
|
+
- `OwnKey` — key type from `Reflect.ownKeys(obj)` (`string | symbol`)
|
|
73
|
+
- `KeyToOwn<T>` — converts `Key` to `OwnKey` (`number` → `string`)
|
|
74
|
+
- `CleanOmit<T, K>` — `Omit` without the `string` key artifact on objects with an index signature
|
|
75
|
+
- `ExcludeFromProperties<T, E>` / `DeepExcludeFromProperties<T, E>` — excludes values from properties
|
|
76
|
+
- `IsPlainObject<T>` — checks whether a value is a plain object
|
|
77
|
+
|
|
78
|
+
### Nullability (nulls)
|
|
79
|
+
|
|
80
|
+
- `DeepRequired<T>` — all properties are required
|
|
81
|
+
- `DeepPartial<T>` — all properties are optional
|
|
82
|
+
- `Nullish<T>` / `DeepNullish<T>` — nullable properties (null | undefined)
|
|
83
|
+
- `Undefinable<T>` / `DeepUndefinable<T>` — properties allow undefined
|
|
84
|
+
- `FullyUndefinable<T>` / `DeepFullyUndefinable<T>` — all properties are optional and allow undefined
|
|
85
|
+
- `IsOptional<T, K>` — property `K` in `T` is declared optional
|
|
86
|
+
- `HasUndefined<T>` — `undefined` is part of the value type
|
|
87
|
+
- `CopyOptionalAndUndefined<Source, Target, Keys?>` — values from `Target` by key, copying optionality and `undefined` from `Source`
|
|
88
|
+
|
|
89
|
+
### Mutability
|
|
90
|
+
|
|
91
|
+
- `DeepReadonly<T, LocalExceptions?>` — recursively makes all properties readonly
|
|
92
|
+
- `DeepWritable<T, LocalExceptions?>` — recursively removes readonly
|
|
93
|
+
- `ReadonlyDate` — Date without mutation methods
|
|
94
|
+
- `Immutable`, `DeepReadonlyExceptions` — exception mechanism for DeepReadonly/DeepWritable
|
|
95
|
+
|
|
96
|
+
### HTTP
|
|
97
|
+
|
|
98
|
+
- `HttpMethod` — union of all HTTP methods
|
|
99
|
+
- `HttpStatusCode` — union of all HTTP status codes
|
|
100
|
+
- `PathParams<Path>` — extracts `:param` parameters from a path string
|
|
101
|
+
|
|
102
|
+
### Maybe (optional values)
|
|
103
|
+
|
|
104
|
+
- `MaybePromise<T>` — value may be `Promise<T>` or synchronous `T`
|
|
105
|
+
- `MaybeArray<T>` — value may be an array `T[]` or a single `T`
|
|
106
|
+
|
|
107
|
+
### Common
|
|
108
|
+
|
|
109
|
+
- `UnionToIntersection<Union>` — converts a union to an intersection
|
|
110
|
+
- `Simplify<T>` — simplifies object type display (useful after intersections and conditional types)
|
|
111
|
+
|
|
112
|
+
## Documentation
|
|
113
|
+
|
|
114
|
+
Detailed documentation:
|
|
115
|
+
|
|
116
|
+
- [Project structure](documents/STRUCTURE.md)
|
|
117
|
+
- [Scripts](documents/SCRIPTS.md)
|
|
118
|
+
- [Style guide](documents/STYLE_GUIDE.md)
|
|
119
|
+
- [Contributing](documents/CONTRIBUTING.md)
|
|
120
|
+
|
|
121
|
+
Full API documentation is available in JSDoc comments. Use IDE autocomplete to browse it.
|
|
122
|
+
|
|
123
|
+
## Requirements
|
|
124
|
+
|
|
125
|
+
- Node.js >= 22.0.0
|
|
126
|
+
- pnpm >= 10.17.0
|
|
127
|
+
- TypeScript >= 5.9.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
//#region lib/http/methods.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* HTTP methods.
|
|
4
|
+
*/
|
|
5
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "CONNECT" | "TRACE";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region lib/http/path-params.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Extracts path parameters from a path string.
|
|
10
|
+
*
|
|
11
|
+
* Supports path parameters in the `:paramName` format.
|
|
12
|
+
* If the path contains parameters, returns an object with parameter names as keys and `string` values.
|
|
13
|
+
* If the path has no parameters, returns `Record<string, never>`.
|
|
14
|
+
* If the path type cannot be inferred (generic `string`), returns `Record<string, string>` for compatibility.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* PathParams<"/users/:id"> // => { id: string }
|
|
18
|
+
* PathParams<"/users/:id/posts/:postId"> // => { id: string; postId: string }
|
|
19
|
+
* PathParams<"/users"> // => Record<string, never>
|
|
20
|
+
* PathParams<string> // => Record<string, string>
|
|
21
|
+
*/
|
|
22
|
+
type PathParams<Path extends string> = string extends Path ? Record<string, string> : Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param]: string } & PathParams<`/${Rest}`> : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Record<string, never>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region lib/http/status-codes.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* HTTP status codes.
|
|
27
|
+
*
|
|
28
|
+
* Includes all standard HTTP codes:
|
|
29
|
+
* - 1xx: Informational
|
|
30
|
+
* - 2xx: Success
|
|
31
|
+
* - 3xx: Redirection
|
|
32
|
+
* - 4xx: Client error
|
|
33
|
+
* - 5xx: Server error
|
|
34
|
+
*/
|
|
35
|
+
type HttpStatusCode = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region lib/mutability/exceptions.d.ts
|
|
38
|
+
/**
|
|
39
|
+
* Symbol for marking a type as Immutable.
|
|
40
|
+
*/
|
|
41
|
+
declare const IsImmutable: unique symbol;
|
|
42
|
+
/**
|
|
43
|
+
* Type marker for Immutable.
|
|
44
|
+
*/
|
|
45
|
+
interface Immutable {
|
|
46
|
+
[IsImmutable]: true;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Types to exclude from deep readonly.
|
|
50
|
+
* Extend via declaration merging.
|
|
51
|
+
*/
|
|
52
|
+
interface DeepReadonlyExceptions {}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region lib/mutability/readonly/common.d.ts
|
|
55
|
+
/**
|
|
56
|
+
* Recursively makes all object properties readonly.
|
|
57
|
+
*
|
|
58
|
+
* @param T — object whose properties become readonly
|
|
59
|
+
* @returns object with all properties readonly
|
|
60
|
+
*/
|
|
61
|
+
type DeepReadonly<T, LocalExceptions = never> = IsDeepReadonlyException<T, LocalExceptions> extends true ? T : T extends Immutable ? T : T extends ((...args: any[]) => any) ? T : T extends readonly [...infer R] ? { readonly [K in keyof R]: DeepReadonly<R[K], LocalExceptions> } : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K, LocalExceptions>, DeepReadonly<V, LocalExceptions>> : T extends ReadonlySet<infer E> ? ReadonlySet<DeepReadonly<E, LocalExceptions>> : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K], LocalExceptions> } : T;
|
|
62
|
+
type IsDeepReadonlyException<T, LocalExceptions = never> = [T] extends [LocalExceptions] ? true : T extends {
|
|
63
|
+
constructor: infer C;
|
|
64
|
+
} ? C extends keyof DeepReadonlyExceptions ? true : false : false;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region lib/objects/keys.d.ts
|
|
67
|
+
/**
|
|
68
|
+
* Adds a prefix to all keys of an object.
|
|
69
|
+
*
|
|
70
|
+
* @param T — object whose keys receive the prefix
|
|
71
|
+
* @param Prefix — prefix to prepend to keys
|
|
72
|
+
* @returns object with prefixed keys
|
|
73
|
+
*/
|
|
74
|
+
type PrefixKeys<T extends Record<string, unknown>, Prefix extends string = ""> = { [K in keyof T & string as `${Prefix}${K}`]: T[K] };
|
|
75
|
+
/**
|
|
76
|
+
* Gets object keys that start with the given prefix.
|
|
77
|
+
*
|
|
78
|
+
* @param T — object whose keys are filtered
|
|
79
|
+
* @param Prefix — prefix to match
|
|
80
|
+
* @returns keys starting with the prefix
|
|
81
|
+
*/
|
|
82
|
+
type KeysStartingWith<T, Prefix extends string> = Extract<keyof T, `${Prefix}${string}`>;
|
|
83
|
+
/**
|
|
84
|
+
* Any valid key when accessing an object property.
|
|
85
|
+
* Use when describing keys that may be a string, number (index), or symbol.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const key: Key = "foo"
|
|
90
|
+
* const key2: Key = Symbol("bar")
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
type Key = string | number | symbol;
|
|
94
|
+
/**
|
|
95
|
+
* Key type returned by `Reflect.ownKeys(obj)`.
|
|
96
|
+
* Strings (including numeric indices like "0") and symbols — no separate `number`,
|
|
97
|
+
* because numeric keys are enumerated as strings.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const keys: OwnKey[] = Reflect.ownKeys({ a: 1, [Symbol()]: 2 })
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
type OwnKey = string | symbol;
|
|
105
|
+
/**
|
|
106
|
+
* Converts `Key` to the corresponding `OwnKey`.
|
|
107
|
+
* `number` → `string` (numeric indices are enumerated as strings),
|
|
108
|
+
* `string` and `symbol` are unchanged.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* type A = KeyToOwn<number> // string
|
|
113
|
+
* type B = KeyToOwn<"foo"> // "foo"
|
|
114
|
+
* type C = KeyToOwn<symbol> // symbol
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
type KeyToOwn<T extends Key> = T extends number ? string : T;
|
|
118
|
+
/**
|
|
119
|
+
* `Omit` that removes the wide `string` key from the type before excluding keys.
|
|
120
|
+
* That key appears on objects with a string index signature (`[key: string]: …`).
|
|
121
|
+
* The result is cleaner and more predictable than plain `Omit<T, K>`.
|
|
122
|
+
*
|
|
123
|
+
* @param T — object to omit keys from
|
|
124
|
+
* @param K — keys to drop
|
|
125
|
+
*/
|
|
126
|
+
type CleanOmit<T, K$1 extends Key> = Omit<{ [P in keyof T as string extends P ? never : P]: T[P] }, K$1>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region lib/mutability/readonly/dates.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Read-only Date without mutation methods.
|
|
131
|
+
*/
|
|
132
|
+
type ReadonlyDate = Omit<Date, KeysStartingWith<Date, "set">>;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region lib/mutability/writable/common.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Recursively makes all object properties writable.
|
|
137
|
+
* Removes readonly modifiers at every level.
|
|
138
|
+
*/
|
|
139
|
+
type DeepWritable<T, LocalExceptions = never> = IsDeepWritableException<T, LocalExceptions> extends true ? T : T extends Immutable ? T : T extends ((...args: any[]) => any) ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepWritable<R[K], LocalExceptions> } : T extends ReadonlyMap<infer K, infer V> ? Map<DeepWritable<K, LocalExceptions>, DeepWritable<V, LocalExceptions>> : T extends ReadonlySet<infer E> ? Set<DeepWritable<E, LocalExceptions>> : T extends object ? { -readonly [K in keyof T]: DeepWritable<T[K], LocalExceptions> } : T;
|
|
140
|
+
type IsDeepWritableException<T, LocalExceptions = never> = [T] extends [LocalExceptions] ? true : T extends {
|
|
141
|
+
constructor: infer C;
|
|
142
|
+
} ? C extends keyof DeepReadonlyExceptions ? true : false : false;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region lib/nulls/checks.d.ts
|
|
145
|
+
/**
|
|
146
|
+
* Checks whether property `K` in `T` is declared optional.
|
|
147
|
+
*
|
|
148
|
+
* @typeParam T — object type
|
|
149
|
+
* @typeParam K — key from `T`
|
|
150
|
+
*/
|
|
151
|
+
type IsOptional<T, K$1 extends keyof T> = Partial<Pick<T, K$1>> extends Pick<T, K$1> ? true : false;
|
|
152
|
+
/**
|
|
153
|
+
* True if `undefined` is part of type `T` (including from an optional property).
|
|
154
|
+
*
|
|
155
|
+
* @typeParam T — property value type
|
|
156
|
+
*/
|
|
157
|
+
type HasUndefined<T> = undefined extends T ? true : false;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region lib/common.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* Converts a union to an intersection.
|
|
162
|
+
*
|
|
163
|
+
* @param Union — union to convert
|
|
164
|
+
* @returns intersection derived from the union
|
|
165
|
+
* @example
|
|
166
|
+
* type Union = "a" | "b" | "c"
|
|
167
|
+
* type Intersection = UnionToIntersection<Union> // "a" & "b" & "c"
|
|
168
|
+
*/
|
|
169
|
+
type UnionToIntersection<Union> = (Union extends any ? (arg: Union) => void : never) extends ((arg: infer Intersection) => void) ?
|
|
170
|
+
// Order matters here - do not swap Intersection and Union
|
|
171
|
+
Intersection & Union : never;
|
|
172
|
+
/**
|
|
173
|
+
* Flattens an object type to the same keys and properties (often simplifies display of
|
|
174
|
+
* intersections and conditional types in editor tooltips).
|
|
175
|
+
*
|
|
176
|
+
* @typeParam T — object type to simplify
|
|
177
|
+
*/
|
|
178
|
+
type Simplify<T> = { [K in keyof T]: T[K] };
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region lib/nulls/copying.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* For keys from `Source` and `Target`, builds a type with values from `Target`, copying from `Source`
|
|
183
|
+
* required/optional field status and adding `| undefined` to the value where `Source`
|
|
184
|
+
* allows `undefined` for the property.
|
|
185
|
+
*
|
|
186
|
+
* @typeParam Source — template type for optionality and `undefined`
|
|
187
|
+
* @typeParam Target — result value type
|
|
188
|
+
* @typeParam Keys — subset of shared keys (defaults to intersection of `Source` and `Target` keys)
|
|
189
|
+
*/
|
|
190
|
+
type CopyOptionalAndUndefined<Source, Target, Keys extends keyof Source & keyof Target = keyof Source & keyof Target> = Simplify<{ [K in Keys as IsOptional<Source, K> extends true ? never : K]: HasUndefined<Source[K]> extends true ? Target[K] | undefined : Target[K] } & { [K in Keys as IsOptional<Source, K> extends true ? K : never]?: HasUndefined<Source[K]> extends true ? Target[K] | undefined : Target[K] }>;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region lib/nulls/nullish.d.ts
|
|
193
|
+
/**
|
|
194
|
+
* Makes all object properties nullable (may be null or undefined).
|
|
195
|
+
*
|
|
196
|
+
* @param T — object whose properties to make nullable
|
|
197
|
+
* @returns object with all nullable properties
|
|
198
|
+
*/
|
|
199
|
+
type Nullish<T> = T extends object ? { [K in keyof T]?: T[K] | undefined | null } : T | undefined | null;
|
|
200
|
+
/**
|
|
201
|
+
* Recursively makes all object properties nullable (may be null or undefined).
|
|
202
|
+
*
|
|
203
|
+
* @param T — object whose properties to make recursively nullable
|
|
204
|
+
* @returns object with all recursively nullable properties
|
|
205
|
+
*/
|
|
206
|
+
type DeepNullish<T> = T extends object ? { [K in keyof T]?: DeepNullish<T[K]> | undefined | null } : T | undefined | null;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region lib/nulls/partial.d.ts
|
|
209
|
+
/**
|
|
210
|
+
* Makes all object properties optional.
|
|
211
|
+
*
|
|
212
|
+
* @param T — object whose properties to make optional
|
|
213
|
+
* @returns object with all optional properties
|
|
214
|
+
*/
|
|
215
|
+
type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region lib/nulls/required.d.ts
|
|
218
|
+
/**
|
|
219
|
+
* Makes all object properties required.
|
|
220
|
+
*
|
|
221
|
+
* @param T — object whose properties to make required
|
|
222
|
+
* @returns object with all required properties
|
|
223
|
+
*/
|
|
224
|
+
type DeepRequired<T> = T extends object ? { [K in keyof T]-?: DeepRequired<T[K]> } : T;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region lib/nulls/undefinable.d.ts
|
|
227
|
+
/**
|
|
228
|
+
* Makes all object properties optional and allows undefined.
|
|
229
|
+
*
|
|
230
|
+
* @param T — object whose properties to make optional with undefined
|
|
231
|
+
* @returns object with all optional properties allowing undefined
|
|
232
|
+
*/
|
|
233
|
+
type FullyUndefinable<T> = Partial<Undefinable<T>>;
|
|
234
|
+
/**
|
|
235
|
+
* Recursively makes all object properties optional and allows undefined.
|
|
236
|
+
*
|
|
237
|
+
* @param T — object whose properties to make recursively optional with undefined
|
|
238
|
+
* @returns object with all recursively optional properties allowing undefined
|
|
239
|
+
*/
|
|
240
|
+
type DeepFullyUndefinable<T> = DeepPartial<DeepUndefinable<T>>;
|
|
241
|
+
/**
|
|
242
|
+
* Makes all object properties allow undefined.
|
|
243
|
+
*
|
|
244
|
+
* @param T — object whose properties to allow undefined
|
|
245
|
+
* @returns object with all properties allowing undefined
|
|
246
|
+
*/
|
|
247
|
+
type Undefinable<T> = T extends object ? { [K in keyof T]: T[K] | undefined } : T | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Recursively makes all object properties allow undefined.
|
|
250
|
+
*
|
|
251
|
+
* @param T — object whose properties to recursively allow undefined
|
|
252
|
+
* @returns object with all recursively undefined-allowing properties
|
|
253
|
+
*/
|
|
254
|
+
type DeepUndefinable<T> = T extends object ? { [K in keyof T]: DeepUndefinable<T[K]> } : T | undefined;
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region lib/objects/properties.d.ts
|
|
257
|
+
/**
|
|
258
|
+
* Excludes specified values from object properties.
|
|
259
|
+
*
|
|
260
|
+
* @param T — object whose property values are filtered
|
|
261
|
+
* @param E — values to exclude
|
|
262
|
+
* @returns object with excluded values removed from properties
|
|
263
|
+
*/
|
|
264
|
+
type ExcludeFromProperties<T, E$1> = T extends object ? { [K in keyof T]: Exclude<T[K], E$1> } : T;
|
|
265
|
+
/**
|
|
266
|
+
* Recursively excludes specified values from all object properties.
|
|
267
|
+
*
|
|
268
|
+
* @param T — object whose property values are filtered
|
|
269
|
+
* @param E — values to exclude
|
|
270
|
+
* @returns object with excluded values removed from properties at all levels
|
|
271
|
+
*/
|
|
272
|
+
type DeepExcludeFromProperties<T, E$1> = T extends object ? { [K in keyof T]: Exclude<DeepExcludeFromProperties<T[K], E$1>, E$1> } : T;
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region lib/objects/traits.d.ts
|
|
275
|
+
/**
|
|
276
|
+
* Checks whether a value is a plain object (not an array or function).
|
|
277
|
+
*
|
|
278
|
+
* @param T — value to check
|
|
279
|
+
* @returns `true` if the value is a plain object, otherwise `false`
|
|
280
|
+
*/
|
|
281
|
+
type IsPlainObject<T> = T extends readonly unknown[] ? false : T extends Function ? false : T extends object ? true : false;
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region lib/strings/misc.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* Replaces all occurrences of a substring with another substring.
|
|
286
|
+
*
|
|
287
|
+
* @param S — string in which to replace
|
|
288
|
+
* @param From — substring to replace
|
|
289
|
+
* @param To — replacement substring
|
|
290
|
+
* @returns string with all replacements applied
|
|
291
|
+
*/
|
|
292
|
+
type ReplaceAll<S extends string, From extends string, To extends string> = From extends "" ? S : S extends `${infer Head}${From}${infer Tail}` ? `${Head}${To}${ReplaceAll<Tail, From, To>}` : S;
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region lib/strings/cases.d.ts
|
|
295
|
+
/**
|
|
296
|
+
* Converts a string to kebab-case.
|
|
297
|
+
*
|
|
298
|
+
* @param S — string to convert
|
|
299
|
+
* @returns string in kebab-case
|
|
300
|
+
*/
|
|
301
|
+
type ToKebabCase<S extends string> = ReplaceAll<S, "_", "-">;
|
|
302
|
+
/**
|
|
303
|
+
* Converts a string to snake_case (supports kebab, snake, and camel input).
|
|
304
|
+
*
|
|
305
|
+
* @param S — string to convert
|
|
306
|
+
* @param Acc — accumulated string (internal parameter)
|
|
307
|
+
* @returns string in snake_case
|
|
308
|
+
*/
|
|
309
|
+
type ToSnakeCase<S extends string, Acc extends string = ""> = S extends `${infer First}-${infer Rest}` ? `${ToSnakeCase<First>}_${ToSnakeCase<Rest>}` : S extends `${infer First}_${infer Rest}` ? `${ToSnakeCase<First>}_${ToSnakeCase<Rest>}` : S extends `${infer First}${infer Rest}` ? First extends Uppercase<First> ? ToSnakeCase<Rest, `${Acc extends "" ? "" : `${Acc}_`}${Lowercase<First>}`> : ToSnakeCase<Rest, `${Acc}${First}`> : `${Acc}${S}`;
|
|
310
|
+
/**
|
|
311
|
+
* Converts a string to camelCase (supports kebab, snake, and camel input).
|
|
312
|
+
*
|
|
313
|
+
* @param S — string to convert
|
|
314
|
+
* @returns string in camelCase
|
|
315
|
+
*/
|
|
316
|
+
type ToCamelCase<S extends string> = S extends `${infer First}-${infer Rest}` ? `${ToCamelCase<First>}${ToPascalCase<Rest>}` : S extends `${infer First}_${infer Rest}` ? `${ToCamelCase<First>}${ToPascalCase<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Uppercase<Head> ? `${Lowercase<Head>}${ToCamelCase<Tail>}` : S : S;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a string to PascalCase (supports kebab, snake, and camel input).
|
|
319
|
+
*
|
|
320
|
+
* @param S — string to convert
|
|
321
|
+
* @returns string in PascalCase
|
|
322
|
+
*/
|
|
323
|
+
type ToPascalCase<S extends string> = Capitalize<ToCamelCase<S>>;
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region lib/strings/parts.d.ts
|
|
326
|
+
/**
|
|
327
|
+
* Removes a prefix from a string.
|
|
328
|
+
*
|
|
329
|
+
* @param T — string to remove the prefix from
|
|
330
|
+
* @param Prefix — prefix to remove
|
|
331
|
+
* @returns string without the prefix
|
|
332
|
+
*/
|
|
333
|
+
type RemovePrefix<T, Prefix extends string> = T extends `${Prefix}${infer Suffix}` ? Suffix : T;
|
|
334
|
+
/**
|
|
335
|
+
* Removes a suffix from a string.
|
|
336
|
+
*
|
|
337
|
+
* @param T — string to remove the suffix from
|
|
338
|
+
* @param Suffix — suffix to remove
|
|
339
|
+
* @returns string without the suffix
|
|
340
|
+
*/
|
|
341
|
+
type RemoveSuffix<T, Suffix extends string> = T extends `${infer Prefix}${Suffix}` ? Prefix : T;
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region lib/logging.d.ts
|
|
344
|
+
/**
|
|
345
|
+
* Minimal logger interface with five standard logging levels.
|
|
346
|
+
* Compatible with `console`, Winston, Pino, Bunyan, and most other loggers.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* // Using with console
|
|
350
|
+
* const logger: Logger = console
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* // Using with a library logger
|
|
354
|
+
* const logger: Logger = pino()
|
|
355
|
+
*/
|
|
356
|
+
type Logger = {
|
|
357
|
+
/** Trace-level logging (most verbose) */
|
|
358
|
+
trace(message: string, ...args: unknown[]): void;
|
|
359
|
+
/** Debug-level logging */
|
|
360
|
+
debug(message: string, ...args: unknown[]): void;
|
|
361
|
+
/** Info-level logging (general information) */
|
|
362
|
+
info(message: string, ...args: unknown[]): void;
|
|
363
|
+
/** Warn-level logging (warnings) */
|
|
364
|
+
warn(message: string, ...args: unknown[]): void;
|
|
365
|
+
/** Error-level logging (errors) */
|
|
366
|
+
error(message: string, ...args: unknown[]): void;
|
|
367
|
+
};
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region lib/maybe.d.ts
|
|
370
|
+
/**
|
|
371
|
+
* A value that may be either `Promise<T>` or synchronous `T`.
|
|
372
|
+
* Useful for functions that may return results synchronously or asynchronously.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* type Result = MaybePromise<string>
|
|
377
|
+
* const sync: Result = "hello"
|
|
378
|
+
* const async: Result = Promise.resolve("hello")
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
382
|
+
/**
|
|
383
|
+
* A value that may be either an array `T[]` or a single element `T`.
|
|
384
|
+
* Convenient for APIs that accept one value or several.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```ts
|
|
388
|
+
* type Ids = MaybeArray<string>
|
|
389
|
+
* const single: Ids = "abc"
|
|
390
|
+
* const multiple: Ids = ["abc", "def"]
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
type MaybeArray<T> = T[] | T;
|
|
394
|
+
//#endregion
|
|
395
|
+
export { CleanOmit, CopyOptionalAndUndefined, DeepExcludeFromProperties, DeepFullyUndefinable, DeepNullish, DeepPartial, DeepReadonly, DeepReadonlyExceptions, DeepRequired, DeepUndefinable, DeepWritable, ExcludeFromProperties, FullyUndefinable, HasUndefined, HttpMethod, HttpStatusCode, Immutable, IsImmutable, IsOptional, IsPlainObject, Key, KeyToOwn, KeysStartingWith, Logger, MaybeArray, MaybePromise, Nullish, OwnKey, PathParams, PrefixKeys, ReadonlyDate, RemovePrefix, RemoveSuffix, ReplaceAll, Simplify, ToCamelCase, ToKebabCase, ToPascalCase, ToSnakeCase, Undefinable, UnionToIntersection };
|
|
396
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../lib/http/methods.ts","../lib/http/path-params.ts","../lib/http/status-codes.ts","../lib/mutability/exceptions.ts","../lib/mutability/readonly/common.ts","../lib/objects/keys.ts","../lib/mutability/readonly/dates.ts","../lib/mutability/writable/common.ts","../lib/nulls/checks.ts","../lib/common.ts","../lib/nulls/copying.ts","../lib/nulls/nullish.ts","../lib/nulls/partial.ts","../lib/nulls/required.ts","../lib/nulls/undefinable.ts","../lib/objects/properties.ts","../lib/objects/traits.ts","../lib/strings/misc.ts","../lib/strings/cases.ts","../lib/strings/parts.ts","../lib/logging.ts","../lib/maybe.ts"],"sourcesContent":[],"mappings":";;AAGA;;KAAY,UAAA;;;;AAAZ;;;;ACWA;;;;;;;;;AAMQ,KANI,UAMJ,CAAA,aAAA,MAAA,CAAA,GAAA,MAAA,SANqD,IAMrD,GALJ,MAKI,CAAA,MAAA,EAAA,MAAA,CAAA,GAJJ,IAII,SAAA,GAAA,KAAA,OAAA,IAAA,KAAA,MAAA,IAAA,KAAA,KAAA,EAAA,GAAA,QAHM,KAGA,GAAA,MAAA,KAHmB,eAAe,UAC1C,wDACU,mBACR;;;;ADjBR;;;;ACWA;;;;;AAGgD,KCPpC,cAAA,GDOoC,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAA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V,8CACO,YAAY,SAAS,aAAa,UAErC,8CACK,YAAY,SAAS,aAAa,UAErC,sDACe,UAAU,WAClB,UAAU,QAAQ,YAAY,UACjC,IACF;AflDV;AAKA;AASA;;;;ACRY,KcoDA,YdpDY,CAAA,UAAA,MAAA,CAAA,GcoDqB,UdpDrB,CcoDgC,WdpDhC,CcoD4C,CdpD5C,CAAA,CAAA;;;;AJNxB;;;;ACWA;;AACI,KkBRQ,YlBQR,CAAA,CAAA,EAAA,eAAA,MAAA,CAAA,GkBRiD,ClBQjD,SAAA,GkBR8D,MlBQ9D,GAAA,KAAA,OAAA,EAAA,GAAA,MAAA,GkBNA,ClBMA;;;;;;;;AAKU,KkBFF,YlBEE,CAAA,CAAA,EAAA,eAAA,MAAA,CAAA,GkBFuC,ClBEvC,SAAA,GAAA,KAAA,OAAA,GkBFmE,MlBEnE,EAAA,GAAA,MAAA,GkBAV,ClBAU;;;;ADjBd;;;;ACWA;;;;;;;AAIM,KmBNM,MAAA,GnBMN;EACU;EACR,KAAA,CAAA,OAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAAM;;;;ECVF;;;;ACPZ,CAAA;;;;AHAA;;;;ACWA;;;;;;AAGiC,KoBNrB,YpBMqB,CAAA,CAAA,CAAA,GoBNH,OpBMG,CoBNK,CpBML,CAAA,GoBNU,CpBMV;;;;;;;;ACPjC;;;;ACPa,KkBqBD,UlBrBmD,CAAA,CAAA,CAAA,GkBqBnC,ClBrBmC,EAAA,GkBqB7B,ClBrB6B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../lib/mutability/exceptions.ts"],"sourcesContent":["/**\n * Symbol for marking a type as Immutable.\n */\nexport const IsImmutable: unique symbol = Symbol(\"IsImmutable\")\n\n/**\n * Type marker for Immutable.\n */\nexport interface Immutable {\n [IsImmutable]: true\n}\n\n/**\n * Types to exclude from deep readonly.\n * Extend via declaration merging.\n */\n// biome-ignore lint/suspicious/noEmptyInterface: Made intentionally empty\nexport interface DeepReadonlyExceptions {}\n"],"mappings":";;;;AAGA,MAAa,cAA6B,OAAO,cAAc"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cutticat/types",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "1.7.1",
|
|
7
|
+
"description": "CuttiCat Types Library",
|
|
8
|
+
"author": "Maksim Victorovich Fomin",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://gitflic.ru/project/cutticat-npm/types.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"typescript",
|
|
15
|
+
"types",
|
|
16
|
+
"utility-types",
|
|
17
|
+
"generics",
|
|
18
|
+
"readonly",
|
|
19
|
+
"nullability",
|
|
20
|
+
"http",
|
|
21
|
+
"type-level",
|
|
22
|
+
"cutticat"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@biomejs/biome": "^2.3.13",
|
|
31
|
+
"rimraf": "^6.1.0",
|
|
32
|
+
"@types/node": "^25.0.3",
|
|
33
|
+
"tsdown": "0.19.0-beta.2",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist/**/*"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"lint": "biome check .",
|
|
49
|
+
"lint:fix": "biome check --write .",
|
|
50
|
+
"lint:fix:unsafe": "biome check --write --unsafe .",
|
|
51
|
+
"format": "biome format --write .",
|
|
52
|
+
"format:check": "biome format .",
|
|
53
|
+
"clean": "rimraf ./dist",
|
|
54
|
+
"build": "tsc --noEmit && tsdown"
|
|
55
|
+
}
|
|
56
|
+
}
|