ts-type 3.0.13 → 3.0.15
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/CHANGELOG.md +35 -0
- package/lib/_build-in.js.map +1 -1
- package/lib/generic.js.map +1 -1
- package/lib/helper/array/readonly.js.map +1 -1
- package/lib/helper/conditional.js.map +1 -1
- package/lib/helper/deep-map.js.map +1 -1
- package/lib/helper/filter.js.map +1 -1
- package/lib/helper/infer.js.map +1 -1
- package/lib/helper/intersection.js.map +1 -1
- package/lib/helper/key-value.d.ts +42 -5
- package/lib/helper/key-value.js.map +1 -1
- package/lib/helper/number.js.map +1 -1
- package/lib/helper/readonly.js.map +1 -1
- package/lib/helper/record/enum.js.map +1 -1
- package/lib/helper/record/member.js.map +1 -1
- package/lib/helper/record/omit-index.js.map +1 -1
- package/lib/helper/record/partial.js.map +1 -1
- package/lib/helper/record/pick-type.js.map +1 -1
- package/lib/helper/record.js.map +1 -1
- package/lib/helper/string/infer.js.map +1 -1
- package/lib/helper/string/literal-string.js.map +1 -1
- package/lib/helper/string/operations.js.map +1 -1
- package/lib/helper/string.js.map +1 -1
- package/lib/helper/tuple.js.map +1 -1
- package/lib/helper/typeof.js.map +1 -1
- package/lib/helper.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/internal/filter.js.map +1 -1
- package/lib/internal/logic/string-literal.js.map +1 -1
- package/lib/logic/any.js.map +1 -1
- package/lib/logic/never.js.map +1 -1
- package/lib/logic/record/empty.js.map +1 -1
- package/lib/logic/union/index.js.map +1 -1
- package/lib/type/base.js.map +1 -1
- package/lib/type/generator.js.map +1 -1
- package/lib/type/iterator.js.map +1 -1
- package/lib/type/promise.js.map +1 -1
- package/lib/type/proxy.js.map +1 -1
- package/lib/type/record/empty.js.map +1 -1
- package/lib/type/record/enum.js.map +1 -1
- package/lib/type/record/partial.js.map +1 -1
- package/lib/type/record/readonly.js.map +1 -1
- package/lib/type/record/union.d.ts +139 -0
- package/lib/type/record/union.js +27 -0
- package/lib/type/record/union.js.map +1 -0
- package/lib/type/record.d.ts +32 -24
- package/lib/type/record.js.map +1 -1
- package/lib/type/tuple/empty.js.map +1 -1
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.15](https://github.com/bluelovers/ws-ts-type/compare/ts-type@3.0.14...ts-type@3.0.15) (2026-09-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ✨ Features
|
|
11
|
+
|
|
12
|
+
* **ts-type:** 新增聯集轉可選類型相關工具類型 ([28cdc58](https://github.com/bluelovers/ws-ts-type/commit/28cdc58f2553631d4f8367f5f1c981cdfec4c6ba))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.0.14](https://github.com/bluelovers/ws-ts-type/compare/ts-type@3.0.13...ts-type@3.0.14) (2026-09-25)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🐛 Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ts-type:** 修復聯集類型扁平化後的屬性映射邏輯 ([201f812](https://github.com/bluelovers/ws-ts-type/commit/201f8120c8ce21a1655b805fd809e2bdb5120ce3))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### ✨ Features
|
|
26
|
+
|
|
27
|
+
* **ts-type:** 新增針對聯集類型的 Record 操作工具 ([cfc6f73](https://github.com/bluelovers/ws-ts-type/commit/cfc6f7328b910281a245a66a8205a454d30cf521))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### 📦 Code Refactoring
|
|
31
|
+
|
|
32
|
+
* **ts-type:** 優化類型定義結構與清理註解格式 ([d83912f](https://github.com/bluelovers/ws-ts-type/commit/d83912fcc7bd313f7af39140e8d70a951bcb8051))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### ♻️ Chores
|
|
36
|
+
|
|
37
|
+
* **build:** 將專案腳本從 yarn 遷移至 pnpm ([7e4ef6b](https://github.com/bluelovers/ws-ts-type/commit/7e4ef6b601bdc50a6202ecf0cad90dc91b0902d6))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [3.0.13](https://github.com/bluelovers/ws-ts-type/compare/ts-type@3.0.12...ts-type@3.0.13) (2026-03-31)
|
|
7
42
|
|
|
8
43
|
|
package/lib/_build-in.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_build-in.js","sourceRoot":"","sources":["_build-in.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Created by user on 2019/6/11.\n
|
|
1
|
+
{"version":3,"file":"_build-in.js","sourceRoot":"","sources":["_build-in.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * Created by user on 2019/6/11.\n *\n * 重新導出內建類型\n * Re-export built-in types\n *\n * 在某些情況下 IDE 無法正確識別類型,此文件提供統一的類別導出\n * In some cases IDE cannot correctly identify types, this file provides unified type exports\n */\n\n/**\n * 取得函數的參數類型\n * Get the parameter types of a function\n *\n * @example\n * function greet(name: string, age: number): string {\n * return `Hello, ${name}, you are ${age} years old.`;\n * }\n * type Params = ITSParameters<typeof greet>;\n * // type Params = [name: string, age: number]\n *\n * @see Parameters\n */\nexport type ITSParameters<T extends (...args: any[]) => any> = Parameters<T>\n/**\n * 取得建構函數的參數類型\n * Get the constructor parameter types\n *\n * @example\n * class User {\n * constructor(public name: string, public age: number) {}\n * }\n * type CtorParams = ITSConstructorParameters<typeof User>;\n * // type CtorParams = [name: string, age: number]\n *\n * @see ConstructorParameters\n */\nexport type ITSConstructorParameters<T extends new (...args: any[]) => any> = ConstructorParameters<T>\n/**\n * 將類型的所有屬性設為可選\n * Make all properties of T optional\n *\n * @example\n * interface User { name: string; age: number; }\n * type PartialUser = ITSPartial<User>;\n * // type PartialUser = { name?: string; age?: number; }\n *\n * @see Partial\n */\nexport type ITSPartial<T> = Partial<T>\n/**\n * 從類型 T 中選取指定的屬性 K\n * Pick a set of properties K from T\n *\n * @example\n * interface User { name: string; age: number; email: string; }\n * type PickedUser = ITSPick<User, 'name' | 'age'>;\n * // type PickedUser = { name: string; age: number; }\n *\n * @see Pick\n */\nexport type ITSPick<T, K extends keyof T = keyof T> = Pick<T, K>\n/**\n * 取得建構函數實例的類型\n * Get the instance type created by a constructor\n *\n * @example\n * class User { name: string; }\n * type UserInstance = ITSInstanceType<typeof User>;\n * // type UserInstance = User\n *\n * @see InstanceType\n */\nexport type ITSInstanceType<T extends new (...args: any[]) => any> = InstanceType<T>\n\n/**\n * 類別裝飾器類型\n * Class decorator type\n *\n * @example\n * const myClassDecorator: ITSClassDecorator = (target) => {\n * console.log(`Decorating ${target.name}`);\n * return target;\n * };\n *\n * @decorator\n */\nexport type ITSClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;\n/**\n * 屬性裝飾器類型\n * Property decorator type\n *\n * @example\n * const myPropertyDecorator: ITSPropertyDecorator = (target, propertyKey) => {\n * console.log(`Decorating property ${String(propertyKey)} on`, target);\n * };\n *\n * @decorator\n */\nexport type ITSPropertyDecorator = (target: object, propertyKey: string | symbol) => void;\n/**\n * 方法裝飾器類型\n * Method decorator type\n *\n * @example\n * const myMethodDecorator: ITSMethodDecorator = (target, propertyKey, descriptor) => {\n * console.log(`Decorating method ${String(propertyKey)}`);\n * return descriptor;\n * };\n *\n * @decorator\n */\nexport type ITSMethodDecorator = <T>(target: object,\n\tpropertyKey: string | symbol,\n\tdescriptor: TypedPropertyDescriptor<T>,\n) => TypedPropertyDescriptor<T> | void;\n/**\n * 參數裝飾器類型\n * Parameter decorator type\n *\n * @example\n * const myParameterDecorator: ITSParameterDecorator = (target, propertyKey, parameterIndex) => {\n * console.log(`Decorating parameter ${parameterIndex} of ${String(propertyKey)}`);\n * };\n *\n * @decorator\n */\nexport type ITSParameterDecorator = (target: object, propertyKey: string | symbol, parameterIndex: number) => void;\n\n/**\n * 從 T 中排除 null 和 undefined\n * Exclude null and undefined from T\n *\n * @example\n * type Test = string | number | null | undefined;\n * type NonNull = ITSNonNullable<Test>;\n * // type NonNull = string | number\n *\n * @see NonNullable\n * @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#improved-intersection-reduction-union-compatibility-and-narrowing\n */\nexport type ITSNonNullable<T> = NonNullable<T>;\n"]}
|
package/lib/generic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["generic.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 類型函數:返回指定類型的函數\n * Type function: a function that returns the specified type\n
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["generic.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 類型函數:返回指定類型的函數\n * Type function: a function that returns the specified type\n *\n * @example\n * type StringFunc = ITSTypeFunction<string>;\n * // type StringFunc = (...args: any[]) => string\n *\n * @example\n * type NumberFunc = ITSTypeFunction<number>;\n * // type NumberFunc = (...args: any[]) => number\n */\nexport type ITSTypeFunction<T> = (...args: any[]) => T;\n\n/**\n * 類似 Map 的介面定義\n * Map-like interface definition\n */\nexport interface ITSMapLike<K, V>\n{\n\t/**\n\t * 取得指定鍵的值\n\t * Get the value for the specified key\n\t */\n\tget(key: K): V | undefined;\n\n\t/**\n\t * 檢查是否包含指定鍵\n\t * Check if the map contains the specified key\n\t */\n\thas(key: K): boolean;\n}\n\n/**\n * 類似 Set 的介面定義\n * Set-like interface definition\n */\nexport interface ITSSetLike<V>\n{\n\t/**\n\t * 檢查是否包含指定值\n\t * Check if the set contains the specified value\n\t */\n\thas(value: V): boolean;\n}\n\n/**\n * 可解析的類型:支援直接值或 PromiseLike\n * Resolvable type: supports direct value or PromiseLike\n *\n * @see bluebird\n */\nexport type ITSResolvable<R> = R | PromiseLike<R>;\n\n/**\n * 可寫入的類陣列介面\n * Writable array-like interface\n */\nexport interface ITSArrayLikeWriteable<T>\n{\n\t/** 只讀的長度屬性 / Readonly length property */\n\treadonly length: number;\n\n\t/** 數字索引存取 / Numeric index access */\n\t[n: number]: T;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["readonly.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSArrayListMaybeReadonly } from '../../type/base';\n\n/**\n * 將可讀寫陣列轉換為唯讀陣列\n * Convert writable array to readonly array\n
|
|
1
|
+
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["readonly.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSArrayListMaybeReadonly } from '../../type/base';\n\n/**\n * 將可讀寫陣列轉換為唯讀陣列\n * Convert writable array to readonly array\n *\n * @example\n * type Writable = [1, 2, 3];\n * type Readonly = ITSToReadonlyArray<Writable>; // readonly [1, 2, 3]\n */\nexport type ITSToReadonlyArray<T extends ITSArrayListMaybeReadonly<any>> = T extends [...infer R] | readonly [...infer R]\n\t? readonly [...R]\n\t: never\n\t;\n\n/**\n * 將唯讀陣列轉換為可讀寫陣列\n * Convert readonly array to writable array\n *\n * @example\n * type Readonly = readonly [1, 2, 3];\n * type Writable = ITSToWriteableArray<Readonly>; // [1, 2, 3]\n */\nexport type ITSToWriteableArray<T extends ITSArrayListMaybeReadonly<any>> = T extends [...infer R] | readonly [...infer R]\n\t? [...R]\n\t: never\n\t;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["conditional.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 條件類型工具\n * Conditional Type Utilities\n
|
|
1
|
+
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["conditional.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 條件類型工具\n * Conditional Type Utilities\n *\n * 提供基於條件的類型選擇工具\n * Provides conditional-based type selection utilities\n */\n\n/**\n * 條件類型:根據條件 C 選擇 T 或 U\n * Conditional type: select T or U based on condition C\n *\n * @example\n * type IsString<T> = T extends string ? true : false;\n * type Result = ITSIf<IsString<T>, 'is string', 'not string'>;\n */\nexport type ITSHelperIf<C extends boolean, T, U> = C extends true ? T : U;\n\n/**\n * 條件類型:根據類型匹配選擇 T 或 U\n * Conditional type: select T or U based on type match\n *\n * @example\n * type Result = ITSIfExtends<string, 'text', 'other'>; // 'text'\n * type Result2 = ITSIfExtends<number, 'text', 'other'>; // 'other'\n */\nexport type ITSHelperIfExtends<T, U, IfTrue, IfFalse> = T extends U ? IfTrue : IfFalse;\n\n/**\n * 條件類型:根據類型相等選擇 T 或 U\n * Conditional type: select T or U based on type equality\n *\n * @example\n * type Result = ITSIfEquals<string, string, 'same', 'different'>; // 'same'\n * type Result2 = ITSIfEquals<string, number, 'same', 'different'>; // 'different'\n */\nexport type ITSHelperIfEquals<T, U, IfTrue, IfFalse> = T extends U\n\t? U extends T\n\t\t? IfTrue\n\t\t: IfFalse\n\t: IfFalse;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-map.js","sourceRoot":"","sources":["deep-map.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 深層映射工具\n * Deep Mapping Utilities\n
|
|
1
|
+
{"version":3,"file":"deep-map.js","sourceRoot":"","sources":["deep-map.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 深層映射工具\n * Deep Mapping Utilities\n *\n * 提供對物件進行深層類型轉換的工具\n * Provides utilities for deep type transformation of objects\n */\n\nimport { ITSArrayListMaybeReadonly } from '../type/base';\n\n/**\n * 深層映射:對物件的所有屬性應用轉換 - 無法實現\n * Deep mapping: apply transformation to all properties of an object\n *\n * TypeScript 無法在類型層級將函數作為泛型參數傳遞\n * TypeScript cannot pass functions as generic parameters at type level\n *\n * @example\n * interface User { name: string; profile: { age: number; } }\n * type ReadonlyUser = ITSDeepMap<User, readonly>;\n * // { readonly name: string; readonly profile: { readonly age: number; } }\n */\n// export type ITSDeepMap<T, F> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSDeepMap<T, F> = T extends object \n// \t? T extends ITSArrayListMaybeReadonly<any>\n// \t\t? T\n// \t\t: {\n// \t\t\t[K in keyof T]: ITSDeepMap<T[K], F>;\n// \t\t }\n// \t: T;\n\n/**\n * 深層映射:對物件的所有屬性應用轉換(包含陣列)- 無法實現\n * Deep mapping: apply transformation to all properties of an object (including arrays)\n *\n * TypeScript 無法在類型層級將函數作為泛型參數傳遞\n * TypeScript cannot pass functions as generic parameters at type level\n *\n * @example\n * interface Data { items: string[]; nested: { values: number[]; } }\n * type ReadonlyData = ITSDeepMapWithArrays<Data, readonly>;\n * // { readonly items: readonly string[]; readonly nested: { readonly values: readonly number[]; } }\n */\n// export type ITSDeepMapWithArrays<T, F> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSDeepMapWithArrays<T, F extends (x: any) => any> = T extends object \n// \t? T extends ITSArrayListMaybeReadonly<any>\n// \t\t? F<T>\n// \t\t: {\n// \t\t\t[K in keyof T]: ITSDeepMapWithArrays<T[K], F>;\n// \t\t }\n// \t: T;\n\n/**\n * 深層部分映射:對物件的所有屬性應用 Partial\n * Deep partial mapping: apply Partial to all properties of an object\n *\n * @example\n * interface User { name: string; profile: { age: number; } }\n * type PartialUser = ITSDeepPartial<User>;\n * // { name?: string; profile?: { age?: number; } }\n */\nexport type ITSDeepPartial<T> = T extends object\n\t? T extends ITSArrayListMaybeReadonly<any>\n\t\t? T\n\t\t: {\n\t\t\t[K in keyof T]?: ITSDeepPartial<T[K]>;\n\t\t}\n\t: T;\n\n/**\n * 深層必填映射:對物件的所有屬性應用 Required\n * Deep required mapping: apply Required to all properties of an object\n *\n * @example\n * interface User { name?: string; profile?: { age?: number; } }\n * type RequiredUser = ITSDeepRequired<User>;\n * // { name: string; profile: { age: number; } }\n */\nexport type ITSDeepRequired<T> = T extends object\n\t? T extends ITSArrayListMaybeReadonly<any>\n\t\t? T\n\t\t: {\n\t\t\t[K in keyof T]-?: ITSDeepRequired<T[K]>;\n\t\t}\n\t: T;\n"]}
|
package/lib/helper/filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["filter.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/8.\n */\n\n/**\n * 從 T 中排除可指派給 U 的類型,並替換為 R\n * Exclude from T those types that are assignable to U, and replace to R\n
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["filter.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/8.\n */\n\n/**\n * 從 T 中排除可指派給 U 的類型,並替換為 R\n * Exclude from T those types that are assignable to U, and replace to R\n *\n * @example\n * type Test = string | number | boolean;\n * type Result = ITSExclude2<Test, string, never>; // number | boolean\n */\nexport type ITSExclude2<T, U, R = T> = T extends U ? never : R;\n\n/**\n * 從 T 中提取可指派給 U 的類型,並替換為 R\n * Extract from T those types that are assignable to U, and replace to R\n *\n * @example\n * type Test = string | number | boolean;\n * type Result = ITSExtract2<Test, string, 'text'>; // 'text' | number | boolean\n */\nexport type ITSExtract2<T, U, R = T> = T extends U ? R : never;\n\n/**\n * 提取 T 中屬於 U 的鍵\n * Extract keys from T that belong to U\n */\nexport type ITSExtractKeyof<T, U> = Extract<keyof T, U>;\n\n/**\n * 從類陣列類型中提取指定索引的類型\n * Extract types of specified indexes from array-like type\n *\n * @example\n * type Test = [string, number, boolean];\n * type Result = ITSExtractArrayLike<Test, 0 | 2>; // [string, boolean]\n */\nexport type ITSExtractArrayLike<A, K extends Extract<keyof A, number> = Extract<keyof A, number>> = {\n\t[Index in K]: A[Index];\n};\n\n/**\n * 取得類陣列類型的所有數字索引鍵\n * Get all numeric index keys of array-like type\n */\nexport type ITSKeyofArrayLike<A> = keyof ITSExtractArrayLike<A>;\n\n/**\n * 取得可為 null 或 undefined 的類型\n * Get types that can be null or undefined\n *\n * @example\n * type Test = string | number | null;\n * type Result = ITSNullable<Test>; // string | number | null\n */\nexport type ITSNullable<T> = T extends null | undefined ? T : never;\n\n/**\n * 找出 T 當中與 U 相同的鍵\n * Find keys that are the same between T and U\n *\n * @example\n * type A = { a: 1; b: 2; };\n * type B = { a: 3; c: 4; };\n * type Result = ITSKeyofSame<A, B>; // 'a'\n */\nexport type ITSKeyofSame<T, U> = Extract<keyof T, keyof U>;\n/**\n * 找出 T 當中與 U 不同的鍵\n * Find keys that are different between T and U\n *\n * @example\n * type A = { a: 1; b: 2; };\n * type B = { a: 3; c: 4; };\n * type Result = ITSKeyofDiff<A, B>; // 'b'\n */\nexport type ITSKeyofDiff<T, U> = Exclude<keyof T, ITSKeyofSame<T, U>>;\n\n/**\n * 找出 T 與 U 當中同時存在的鍵\n * Find keys that exist in both T and U\n *\n * @example\n * type A = { a: 1; b: 2; };\n * type B = { a: 3; c: 4; };\n * type Result = ITSKeyofBothSame<A, B>; // 'a'\n */\nexport type ITSKeyofBothSame<T, U> = ITSKeyofSame<T, U> | ITSKeyofSame<U, T>;\n\n/**\n * 去除 T 與 U 當中同時存在的鍵\n * Remove keys that exist in both T and U\n *\n * @example\n * type A = { a: 1; b: 2; };\n * type B = { a: 3; c: 4; };\n * type Result = ITSKeyofBothDiff<A, B>; // 'b' | 'c'\n */\nexport type ITSKeyofBothDiff<T, U> = ITSKeyofDiff<T, U> | ITSKeyofDiff<U, T>;\n\n/**\n * ITSFilterKeysString - 基礎鍵過濾類型\n * 從聯合類型中排除指定的字符串鍵\n *\n * 使用範例:\n * @example\n * type AllKeys = 'log' | 'debug' | 'constructor' | 'error';\n * type PublicKeys = ITSFilterKeysString<AllKeys, 'constructor'>; // 'log' | 'debug' | 'error'\n * type SafeKeys = ITSFilterKeysString<AllKeys, 'constructor' | 'error'>; // 'log' | 'debug'\n *\n * @example\n * type ITSFilterKeysString<T, ExcludeKeys extends string = never> = T extends infer U\n * \t? U extends string\n * \t\t? U extends ExcludeKeys ? never : U\n * \t\t: never\n * \t: never;\n *\n * @see ITSExcludeFilterKeys\n */\nexport type ITSExcludeFilterKeysString<T, ExcludeKeys extends string = never> = ITSExcludeFilterKeys<T, ExcludeKeys, string>;\n\n/**\n * ITSFilterKeysPropertyKey - 支持 PropertyKey(string | number | symbol)的版本\n *\n * 使用範例:\n * @example\n * type AllKeys = 'log' | 'debug' | 'constructor' | 42 | symbol;\n * type StringKeys = ITSFilterKeysPropertyKey<AllKeys, number | symbol>; // 'log' | 'debug' | 'constructor'\n * type NoSymbol = ITSFilterKeysPropertyKey<AllKeys, symbol>; // 'log' | 'debug' | 'constructor' | 42\n *\n * @example\n * type ITSFilterKeysPropertyKey<T, ExcludeKeys extends PropertyKey = never> = T extends infer U\n * \t? U extends PropertyKey\n * \t\t? U extends ExcludeKeys ? never : U\n * \t\t: never\n * \t: never;\n *\n * @see ITSExcludeFilterKeys\n */\nexport type ITSExcludeFilterKeysPropertyKey<T, ExcludeKeys extends PropertyKey = never> = ITSExcludeFilterKeys<T, ExcludeKeys, PropertyKey>;\n\n/**\n * ITSFilterKeys - 可配置鍵類型範圍的版本\n * 第三個類型參數 `AllowedPropertyKey` 允許精確控制保留哪些類型的鍵\n *\n * 使用範例:\n * @example\n * ```\n * type AllKeys = 'log' | 'debug' | 42 | 99 | symbol;\n *\n * // 只保留 string 類型,排除 'log'\n * type StringOnly = ITSFilterKeys<AllKeys, 'log', string>; // 'debug'\n *\n * // 只保留 number 類型,不排除任何鍵\n * type NumOnly = ITSFilterKeys<AllKeys, never, number>; // 42 | 99\n *\n * // 保留 string | number,排除 'debug'\n * type Mixed = ITSFilterKeys<AllKeys, 'debug', string | number>; // 'log' | 42 | 99\n * ```\n *\n * 三代版本對比:\n * ITSFilterKeysString: 固定處理 string(最基礎)\n * ITSFilterKeysPropertyKey: 固定處理 PropertyKey(更廣泛)\n * ITSFilterKeys: 可配置 AllowedPropertyKey 參數(最靈活)\n *\n * @see ITSExtractKeysV13\n */\nexport type ITSExcludeFilterKeys<T, ExcludeKeys extends PropertyKey = never, AllowedPropertyKey extends PropertyKey = PropertyKey> = T extends infer U\n\t? U extends AllowedPropertyKey\n\t\t? U extends ExcludeKeys ? never : U\n\t\t: never\n\t: never;\n\n/**\n * ITSExtractKeysV13 - 選擇器版本(只保留匹配 IncludeKeys 的鍵)\n *\n * 與 FilterKeysV3 的邏輯差異:\n * - FilterKeysV3: `U extends ExcludeKeys ? never : U` → 排除匹配的鍵\n * - ITSExtractKeysV13: `U extends IncludeKeys ? U : never` → 只保留匹配的鍵\n *\n * 設計理念:\n * ---------------------------\n * ExtractKeyofV12 系列的核心需求是「篩選符合 V 類型的鍵」。\n * FilterKeys 系列的設計是「排除」思維( ExcludeKeys ),\n * 而 ITSExtractKeysV13 採用「選擇」思維( IncludeKeys ),更符合鍵提取的語義。\n *\n * 與 FilterKeysV3 實作的對比:\n * - FilterKeysV3: `FilterKeysV3<T, never, V>`(用 AllowedPropertyKey 篩選,ExcludeKeys 設為 never)\n * - ITSExtractKeysV13: `ITSExtractKeysV13<T, V, PropertyKey>`(直接用 IncludeKeys 篩選)\n *\n * 使用範例與測試驗證:\n * ```typescript\n * type AllKeys = 'log' | 'debug' | 'error' | 42 | 99 | symbol;\n *\n * // 1. 篩選 string 類型鍵(等同 ExtractKeyofV12d<AllKeys, string>)\n * // ✅ 結果:'log' | 'debug' | 'error'\n * type Strings = ITSExtractKeysV13<AllKeys, string, PropertyKey>;\n *\n * // 2. 篩選 number 類型鍵\n * // ✅ 結果:42 | 99\n * type Numbers = ITSExtractKeysV13<AllKeys, number, PropertyKey>;\n *\n * // 3. 只保留特定字面量\n * // ✅ 結果:'log' | 'debug'\n * type Picked = ITSExtractKeysV13<AllKeys, 'log' | 'debug', PropertyKey>;\n *\n * // 4. 特定數字字面量(只保留 42,過濾 99)\n * // ✅ 結果:42\n * // ❌ 99 會被過濾\n * type SpecificNumber = ITSExtractKeysV13<AllKeys, 42, PropertyKey>;\n *\n * // 5. 實作 ExtractKeyofV12(輸出轉為 string)\n * // ✅ 結果:'log' | 'debug' | 'error'\n * type V12_Strings = ITSExtractKeysV13<AllKeys, string, PropertyKey> & string;\n *\n * // 6. 限制輸入類型為 string(等同 FilterKeysV3<AllKeys, never, string>)\n * // ✅ 結果:'log' | 'debug' | 'error'\n * // ❌ number/symbol 被過濾\n * type StringOnly = ITSExtractKeysV13<AllKeys, PropertyKey, string>;\n *\n * // 7. symbol 類型篩選(結果為 never)\n * // ✅ 結果:never(symbol 無法通過 PropertyKey 匹配 string/number)\n * type SymbolFiltered = ITSExtractKeysV13<AllKeys, symbol, PropertyKey>;\n * ```\n *\n * Enum 類型處理範例:\n * ------------------\n * TypeScript enum 作為類型時,需使用模板字面量 `${Enum}` 或 keyof typeof 獲取成員。\n *\n * ```typescript\n * enum LogLevel {\n * DEBUG = 'debug',\n * INFO = 'info',\n * WARN = 'warn',\n * ERROR = 'error'\n * }\n *\n * enum StatusCode {\n * OK = 200,\n * NOT_FOUND = 404,\n * ERROR = 500\n * }\n *\n * // 8. 從 enum 鍵中篩選(使用 keyof typeof)\n * // ✅ 結果:'DEBUG' | 'INFO'\n * type EnumKeys = keyof typeof LogLevel; // 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'\n * type PickedEnumKeys = ITSExtractKeysV13<EnumKeys, 'DEBUG' | 'INFO', PropertyKey>;\n *\n * // 11. 數字 enum 的值篩選(使用 infer 提取數字)\n * // ✅ 結果:200 | 500\n * type StatusEnumValues = `${StatusCode}` extends `${infer N extends number}` ? N : never;\n * type PickedStatusValues = ITSExtractKeysV13<200 | 404 | 500, StatusEnumValues, PropertyKey>;\n *\n * // 12. enum 作為第二參數(IncludeKeys)使用 ITSTypeAndStringLiteral\n * // 搭配 ts-type 的 ITSTypeAndStringLiteral 可直接將 enum 轉為 string 字面量\n * // ✅ 結果:'debug' | 'error'\n * import { ITSTypeAndStringLiteral } from 'ts-type';\n * type MixedInput = ITSTypeAndStringLiteral<LogLevel> | 42 | symbol;\n * type EnumAsIncludeKeys = ITSTypeAndStringLiteral<LogLevel.DEBUG | LogLevel.ERROR>;\n * type Filtered = ITSExtractKeysV13<MixedInput, EnumAsIncludeKeys, PropertyKey>;\n * // ✅ 可賦值:LogLevel.DEBUG, LogLevel.ERROR\n * // ❌ 被過濾:'trace', 'fatal', 42, symbol\n *\n * // 13. 數字 enum 直接作為 IncludeKeys\n * // ✅ 結果:200 | 404 | 500\n * type AllCodes = 200 | 301 | 404 | 500 | 503;\n * type StatusCodes = ITSExtractKeysV13<AllCodes, StatusCode, PropertyKey>;\n * ```\n *\n * @see ITSExcludeFilterKeys\n */\nexport type ITSExtractKeysV13<T, IncludeKeys extends PropertyKey, AllowedPropertyKey extends PropertyKey = PropertyKey> = T extends infer U\n\t? U extends AllowedPropertyKey\n\t\t? U extends IncludeKeys ? U : never\n\t\t: never\n\t: never;\n\n"]}
|
package/lib/helper/infer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer.js","sourceRoot":"","sources":["infer.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/12.\n */\n\n/**\n * 取得物件指定成員的值類型\n * Get the value type of a specific object member\n
|
|
1
|
+
{"version":3,"file":"infer.js","sourceRoot":"","sources":["infer.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Created by user on 2019/6/12.\n */\n\n/**\n * 取得物件指定成員的值類型\n * Get the value type of a specific object member\n *\n * @example\n * interface User {\n * name: string;\n * age: number;\n * }\n * type NameType = ITSValueOfMember<User, 'name'>; // string\n */\nexport type ITSValueOfMember<T, K extends keyof T> = T extends {\n\t[p in K]: infer U\n} ? U : never;\n\n/**\n * 取得具有 length 屬性之物件的 length 類型\n * Get the length type of an object with length property\n *\n * @example\n * type ArrayLike = { length: 42 };\n * type LengthType = ITSLengthOf<ArrayLike>; // 42\n */\nexport type ITSLengthOf<T extends {\n\tlength: number\n}> = ITSValueOfMember<T, 'length'>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.js","sourceRoot":"","sources":["intersection.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 將聯集類型轉換為交集類型\n * Convert union type to intersection type\n
|
|
1
|
+
{"version":3,"file":"intersection.js","sourceRoot":"","sources":["intersection.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * 將聯集類型轉換為交集類型\n * Convert union type to intersection type\n *\n * @see https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type\n * @example\n * type FunctionUnion = (() => void) | ((p: string) => void);\n * type FunctionIntersection = (() => void) & ((p: string) => void);\n * type SynthesizedFunctionIntersection = ITSUnionToIntersection<FunctionUnion>\n * // type SynthesizedFunctionIntersection = (() => void) & ((p: string) => void)\n */\nexport type ITSUnionToIntersection<U> =\n\t(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never\n"]}
|
|
@@ -30,15 +30,52 @@ export type ITSValueOf<T extends Record<any, any>> = T[keyof T];
|
|
|
30
30
|
/** 取得介面所有值的聯集類型(別名)/ Get the union type of all values in an interface (alias) */
|
|
31
31
|
export type { ITSValueOf as ITSValueOfRecord };
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* Extracts the keys of a type.
|
|
34
|
+
*
|
|
35
|
+
* For a union type, only keys shared by all union members are returned.
|
|
35
36
|
*
|
|
36
37
|
* @example
|
|
37
|
-
*
|
|
38
|
-
* type
|
|
39
|
-
*
|
|
38
|
+
* type A = { name: string; age: number };
|
|
39
|
+
* type B = { name: string; email: string };
|
|
40
|
+
*
|
|
41
|
+
* type Keys = ITSKeyOf<A | B>;
|
|
42
|
+
* // "name"
|
|
40
43
|
*/
|
|
41
44
|
export type ITSKeyOf<T> = keyof T;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts all keys from every member of a union type.
|
|
47
|
+
*
|
|
48
|
+
* Unlike `keyof T`, this distributes over union members and returns
|
|
49
|
+
* the union of their keys.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* type A = { name: string; age: number };
|
|
53
|
+
* type B = { name: string; email: string };
|
|
54
|
+
*
|
|
55
|
+
* type Keys = ITSKeyOfUnion<A | B>;
|
|
56
|
+
* // "name" | "age" | "email"
|
|
57
|
+
*/
|
|
58
|
+
export type ITSKeyOfUnion<T> = T extends any ? keyof T : never;
|
|
59
|
+
/**
|
|
60
|
+
* Extracts the value type associated with a key from a union type.
|
|
61
|
+
*
|
|
62
|
+
* Only union members containing the specified key contribute their value type.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* type T =
|
|
66
|
+
* | { type: "a"; value: number }
|
|
67
|
+
* | { type: "b"; text: string };
|
|
68
|
+
*
|
|
69
|
+
* type Value = ITSValueOfUnion<T, "value">;
|
|
70
|
+
* // number
|
|
71
|
+
*
|
|
72
|
+
* type Text = ITSValueOfUnion<T, "text">;
|
|
73
|
+
* // string
|
|
74
|
+
*
|
|
75
|
+
* type Type = ITSValueOfUnion<T, "type">;
|
|
76
|
+
* // "a" | "b"
|
|
77
|
+
*/
|
|
78
|
+
export type ITSValueOfUnion<T, K extends ITSKeyOfUnion<T>> = T extends unknown ? K extends keyof T ? T[K] : never : never;
|
|
42
79
|
/**
|
|
43
80
|
* 取得指定鍵集合的值類型聯集
|
|
44
81
|
* Get the union of value types for a specified set of keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-value.js","sourceRoot":"","sources":["key-value.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 鍵值對類型操作工具\n * Key-Value Type Manipulation Utilities\n
|
|
1
|
+
{"version":3,"file":"key-value.js","sourceRoot":"","sources":["key-value.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 鍵值對類型操作工具\n * Key-Value Type Manipulation Utilities\n *\n * 提供類型安全的鍵值對操作工具,包括取得物件、Map、陣列的值類型等\n * Provides type-safe key-value pair manipulation utilities\n */\n\nimport { ITSMapLike } from '../generic';\nimport { ITSIteratorLazy } from './typeof';\nimport { ITSArrayListMaybeReadonly } from '../type/base';\n\n/**\n * 取得介面所有值的聯集類型\n * Get the union type of all values in an interface\n *\n * 類似 `Object.values()` 的類型版本,回傳物件所有值的聯集\n * Similar to the type version of `Object.values()`, returns the union of all object values\n *\n * @see https://stackoverflow.com/questions/49285864/is-there-a-valueof-similar-to-keyof-in-typescript\n *\n * @example\n * interface User {\n * name: string;\n * age: number;\n * isActive: boolean;\n * }\n * type UserValues = ITSValueOf<User>;\n * // type UserValues = string | number | boolean\n */\nexport type ITSValueOf<T extends Record<any, any>> = T[keyof T];\n\n/** 取得介面所有值的聯集類型(別名)/ Get the union type of all values in an interface (alias) */\nexport type { ITSValueOf as ITSValueOfRecord };\n\n/**\n * Extracts the keys of a type.\n *\n * For a union type, only keys shared by all union members are returned.\n *\n * @example\n * type A = { name: string; age: number };\n * type B = { name: string; email: string };\n *\n * type Keys = ITSKeyOf<A | B>;\n * // \"name\"\n */\nexport type ITSKeyOf<T> = keyof T;\n\n/**\n * Extracts all keys from every member of a union type.\n *\n * Unlike `keyof T`, this distributes over union members and returns\n * the union of their keys.\n *\n * @example\n * type A = { name: string; age: number };\n * type B = { name: string; email: string };\n *\n * type Keys = ITSKeyOfUnion<A | B>;\n * // \"name\" | \"age\" | \"email\"\n */\nexport type ITSKeyOfUnion<T> =\n\tT extends any ? keyof T : never;\n\n/**\n * Extracts the value type associated with a key from a union type.\n *\n * Only union members containing the specified key contribute their value type.\n *\n * @example\n * type T =\n * | { type: \"a\"; value: number }\n * | { type: \"b\"; text: string };\n *\n * type Value = ITSValueOfUnion<T, \"value\">;\n * // number\n *\n * type Text = ITSValueOfUnion<T, \"text\">;\n * // string\n *\n * type Type = ITSValueOfUnion<T, \"type\">;\n * // \"a\" | \"b\"\n */\nexport type ITSValueOfUnion<\n T,\n K extends ITSKeyOfUnion<T>\n> = T extends unknown\n ? K extends keyof T\n ? T[K]\n : never\n : never;\n\n/**\n * 取得指定鍵集合的值類型聯集\n * Get the union of value types for a specified set of keys\n *\n * @example\n * interface User { name: string; age: number; email: string; }\n * type PickedValues = ITSPickValueOf<User, 'name' | 'age'>;\n * // type PickedValues = string | number\n */\nexport type ITSPickValueOf<T, K extends keyof T> = ITSValueOf<Pick<T, K>>;\n\n/**\n * 迭代器值的類型\n * Iterator value type\n *\n * 從 Iterator 或 IteratorResult 類型中提取值類型\n * Extracts value type from Iterator or IteratorResult types\n *\n * @example\n * type IteratorResultType = ITSValueOfIterator<IteratorResult<string>>;\n * // type IteratorResultType = string[]\n */\nexport type ITSValueOfIterator<T extends ITSIteratorLazy<any>> =\n\t(T extends Iterator<infer U> ? U :\n\t\tT extends IteratorResult<infer U> ? U :\n\t\t\tany)[]\n\t;\n\n/**\n * Map 類型的所有值類型\n * All value types of Map type\n *\n * 提取 Map 類型的泛型參數 V,回傳 V[]\n * Extracts the generic parameter V from Map type, returns V[]\n *\n * @example\n * type MapValues = ITSValueOfMap<Map<string, number>>;\n * // type MapValues = number[]\n */\nexport type ITSValueOfMap<T extends ITSMapLike<any, any>> =\n\tT extends ITSMapLike<any, infer U> ? U[] :\n\t\tany[]\n\t;\n\n/**\n * 陣列的元素類型\n * Array element type\n *\n * 從陣列類型中提取元素類型,支援唯讀陣列和可讀寫陣列\n * Extracts element type from array type, supporting both readonly and writable arrays\n *\n * @example\n * type ArrayElement = ITSValueOfArray<string[]>;\n * // type ArrayElement = string\n *\n * @example\n * type ReadonlyArrayElement = ITSValueOfArray<readonly string[]>;\n * // type ReadonlyArrayElement = string\n */\nexport type ITSValueOfArray<T extends ITSArrayListMaybeReadonly<any>> =\n\tT extends readonly (infer U)[]\n\t\t? U : T extends (infer U)[]\n\t\t\t? U : never\n\t;\n\n/**\n * 類陣列的元素類型\n * Array-like element type\n *\n * 從類陣列物件(如 ArrayLike<T>)中提取元素類型\n * Extracts element type from array-like objects (such as ArrayLike<T>)\n *\n * @example\n * type ArrayLikeElement = ITSValueOfArrayLike<ArrayLike<string>>;\n * // type ArrayLikeElement = string\n */\nexport type ITSValueOfArrayLike<T extends ITSArrayListMaybeReadonly<any> | ArrayLike<any>> =\n\tT extends ITSArrayListMaybeReadonly<T>\n\t\t? ITSValueOfArray<T> : T extends ArrayLike<infer U>\n\t\t\t? U : never\n\t;\n"]}
|
package/lib/helper/number.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["number.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSToStringLiteral } from './string';\n\n/**\n * 將數字或 bigint 轉換為字串字面量類型\n * Convert number or bigint to string literal type\n
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["number.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSToStringLiteral } from './string';\n\n/**\n * 將數字或 bigint 轉換為字串字面量類型\n * Convert number or bigint to string literal type\n *\n * @example\n * type NumType = ITSNumberString<42>; // '42'\n */\nexport type ITSNumberString<N extends number | bigint = number> = ITSToStringLiteral<N>;\n\n/**\n * 從字串中解包出數字類型\n * Unpack number type from string\n *\n * @example\n * type Test = ITSNumberString<123>;\n * type Result = ITSUnpackNumberString<Test>; // 123\n */\nexport type ITSUnpackNumberString<S extends string, R = never> = S extends ITSNumberString<infer N> ? N : R;\n\n/**\n * 數字值類型:數字或字串\n * Number value type: number or string\n */\nexport type ITSNumberValue = number | string;\n\n/**\n * 數字值類型2:數字或數字字串\n * Number value type 2: number or number string\n */\nexport type ITSNumberValue2 = number | ITSNumberString;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["readonly.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSValueOfArray } from './key-value';\n\n/**\n * 將類型的所有屬性設為唯讀且可選\n * Make all properties of a type readonly and optional\n
|
|
1
|
+
{"version":3,"file":"readonly.js","sourceRoot":"","sources":["readonly.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSValueOfArray } from './key-value';\n\n/**\n * 將類型的所有屬性設為唯讀且可選\n * Make all properties of a type readonly and optional\n *\n * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html\n * @example\n * interface User {\n * name: string;\n * age: number;\n * }\n * type ReadonlyPartialUser = ITSReadonlyPartial<User>;\n * // { readonly name?: string; readonly age?: number; }\n */\nexport type ITSReadonlyPartial<T> = {\n\treadonly [P in keyof T]?: T[P]\n};\n\n/**\n * 將類型的所有屬性設為可讀寫\n * Make all properties of a type writable\n *\n * @example\n * interface User {\n * readonly name: string;\n * readonly age: number;\n * }\n * type WritableUser = ITSWriteable<User>;\n * // { name: string; age: number; }\n */\nexport type ITSWriteable<T> = ITSWriteablePick<T, keyof T>;\n\n/**\n * 將指定屬性設為可讀寫\n * Make specified properties writable\n *\n * @example\n * interface User {\n * readonly name: string;\n * readonly age: number;\n * readonly email: string;\n * }\n * type PartialWritable = ITSWriteablePick<User, 'name' | 'age'>;\n * // { name: string; age: number; readonly email?: string; }\n */\nexport type ITSWriteablePick<T, K extends keyof T = keyof T> = {\n\t-readonly [P in K]: T[P];\n};\n\n/**\n * 將指定屬性設為唯讀\n * Make specified properties readonly\n *\n * @example\n * interface User {\n * name: string;\n * age: number;\n * }\n * type ReadonlyPartial = ITSReadonlyPick<User, 'name'>;\n * // { readonly name: string; age?: number; }\n */\nexport type ITSReadonlyPick<T, K extends keyof T = keyof T> = {\n\treadonly [P in K]: T[P];\n};\n\n/**\n * 保留指定屬性可讀寫,其他屬性不變\n * Keep specified properties writable, other properties unchanged\n *\n * @example\n * interface User {\n * readonly name: string;\n * readonly age: number;\n * email: string;\n * }\n * type Result = ITSWriteableWith<User, 'email'>;\n * // { name: readonly string; age: readonly number; email: string; }\n */\nexport type ITSWriteableWith<T, K extends keyof T = keyof T> = Omit<T, K> & ITSWriteablePick<T, K>;\n\n/**\n * 保留指定屬性唯讀,其他屬性不變\n * Keep specified properties readonly, other properties unchanged\n *\n * @example\n * interface User {\n * name: string;\n * age: number;\n * email: string;\n * }\n * type Result = ITSReadonlyWith<User, 'name' | 'age'>;\n * // { readonly name: string; readonly age: number; email: string; }\n */\nexport type ITSReadonlyWith<T, K extends keyof T = keyof T> = Omit<T, K> & ITSReadonlyPick<T, K>;\n\n/**\n * 將唯讀陣列轉換為可讀寫陣列\n * Convert readonly array to writable array\n *\n * @example\n * type ReadonlyArray = readonly [1, 2, 3];\n * type WritableArray = ITSReadonlyToWriteableArray<ReadonlyArray>;\n * // [1, 2, 3]\n */\nexport type ITSReadonlyToWriteableArray<T extends readonly any[]> = Omit<T, keyof any[]> & ITSValueOfArray<T>[] & {\n\t-readonly [P in number | 'length']: T[P]\n};\n\n/**\n * 深層移除唯讀修飾符\n * Deeply remove readonly modifier\n *\n * @example\n * interface Nested {\n * readonly user: {\n * readonly name: string;\n * readonly profile: {\n * readonly age: number;\n * };\n * };\n * }\n * type WritableNested = ITSWriteableDeep<Nested>;\n * // { user: { name: string; profile: { age: number; } } }\n */\nexport type ITSWriteableDeep<T, K extends keyof T = keyof T> = T extends Record<any, any> ? {\n\t-readonly [P in K]: ITSWriteableDeep<T[P]>;\n} : T;\n\n/**\n * 深層添加唯讀修飾符\n * Deeply add readonly modifier\n *\n * @example\n * interface Nested {\n * user: {\n * name: string;\n * profile: {\n * age: number;\n * };\n * };\n * }\n * type ReadonlyNested = ITSReadonlyDeep<Nested>;\n * // { readonly user: { readonly name: string; readonly profile: { readonly age: number; } } }\n */\nexport type ITSReadonlyDeep<T, K extends keyof T = keyof T> =\n\tT extends Record<any, any> ? {\n\t\treadonly [P in K]: ITSReadonlyDeep<T[P]>;\n\t} : T;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 列舉類型工具\n * Enum Type Utilities\n
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["enum.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 列舉類型工具\n * Enum Type Utilities\n *\n * 提供列舉類型的操作工具\n * Provides enum type manipulation utilities\n */\n\nimport { ITSEnumLike, ITSNumberEnumLike } from '../../type/record/enum';\nimport { ITSValueOf } from '../key-value';\nimport { ITSStringInferToNumber } from '../string/infer';\nimport { ITSToStringLiteral } from '../string';\n\n/**\n * 從列舉類型中排除指定值\n * Exclude specified values from enum type\n *\n * @example\n * enum Color { Red, Green, Blue }\n * type ExcludedRed = ITSExcludeEnumValue<Color, Color.Red>;\n * // type ExcludedRed = Color.Green | Color.Blue\n */\nexport type ITSExcludeEnumValue<Enum extends ITSEnumLike, U extends ITSValueOf<Enum>> = Exclude<ITSValueOf<Enum>, U>;\n\n/**\n * 從列舉類型中提取指定值\n * Extract specified values from enum type\n *\n * @example\n * enum Color { Red, Green, Blue }\n * type ExtractedRed = ITSExtractEnumValue<Color, Color.Red>;\n * // type ExtractedRed = Color.Red\n */\nexport type ITSExtractEnumValue<Enum extends ITSEnumLike, U extends ITSValueOf<Enum>> = Extract<ITSValueOf<Enum>, U>;\n\n/**\n * 將數字列舉轉換為純數字類型\n * Convert number enum to pure number type\n *\n * @example\n * enum Status { Active = 1, Inactive = 2 }\n * type NumStatus = ITSNumberEnumToNumber<Status>;\n * // type NumStatus = 1 | 2\n */\nexport type ITSNumberEnumToNumber<T extends number> = ITSStringInferToNumber<ITSToStringLiteral<Extract<T, number>>>\n\n/**\n * 數字列舉與數字的聯合類型\n * Union type of number enum and number\n *\n * @example\n * enum Status { Active = 1, Inactive = 2 }\n * type StatusValue = ITSNumberEnumAndNumber<Status>;\n * // type StatusValue = 1 | 2 | number\n */\nexport type ITSNumberEnumAndNumber<T extends number> = Extract<T, number> | ITSNumberEnumToNumber<T>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member.js","sourceRoot":"","sources":["member.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 記錄成員工具\n * Record Member Utilities\n
|
|
1
|
+
{"version":3,"file":"member.js","sourceRoot":"","sources":["member.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 記錄成員工具\n * Record Member Utilities\n *\n * 提供提取物件成員(方法)的工具類型\n * Provides utility types for extracting object members (methods)\n */\n\nimport { ITSExtractRecord, ITSPickByType } from './pick-type';\nimport { ITSPropertyKey } from '../../type/base';\nimport { ITSExtractKeyof } from '../filter';\n\n/**\n * 過濾出所有成員是函數且鍵類型為字串或符號的屬性\n * Filter out all members that are functions and key types are string or symbol\n *\n * @example\n * class User {\n * name: string;\n * greet(): void;\n * async fetch(): Promise<void>;\n * }\n * type Methods = ITSMemberMethods<User>;\n * // type Methods = { greet(): void; fetch(): Promise<void>; }\n */\nexport type ITSMemberMethods<T> = ITSPickByType<T, Function, Extract<keyof T, ITSPropertyKey>>;\n\n/**\n * 取得物件方法的鍵\n * Get keys of object methods\n *\n * @example\n * class User {\n * name: string;\n * greet(): void;\n * async fetch(): Promise<void>;\n * }\n * type MethodKeys = ITSKeyofMemberMethods<User>;\n * // type MethodKeys = \"greet\" | \"fetch\"\n */\nexport type ITSKeyofMemberMethods<T> = ITSExtractKeyof<ITSMemberMethods<T>, ITSPropertyKey>;\n\n/**\n * 版本 12: 完全泛化版 - 支持任意鍵值類型與自定義條件\n * 可配置:1) 值類型條件 2) 鍵排除列表 3) 輸出鍵類型\n *\n * ✅ 跨模組驗證:使用 infer 延遲類型解析,即使跨模組引用也能正確運作,\n * 避免 IMethods 變為 string 的問題\n *\n * @example\n * ```\n * type IMethods2 = \"assert\" | \"clear\" | \"count\" | \"countReset\" | \"debug\"\n * | \"dir\" | \"dirxml\" | \"error\" | \"group\" | \"groupCollapsed\" | \"groupEnd\"\n * | \"info\" | \"log\" | \"table\" | \"time\" | \"timeEnd\" | \"timeLog\" | \"timeStamp\"\n * | \"trace\" | \"warn\" | \"profile\" | \"profileEnd\"\n * export type IMethods2 = ITSExcludeFilterKeys<ITSExtractKeysV13<ITSMemberMethodsV12<Console, Function, 'constructor'>, string>, \"Console\" | 'new' | 'prototype' | 'Console' | 'length'>;\n * ```\n *\n * 類型參數:\n * - T: 輸入對象類型(需 extends object)\n * - ValueCond: 值類型條件(預設為函數類型 `(...args: any[]) => any`)\n * - ExcludeKeys: 要排除的鍵列表(預設為 never,不排除任何鍵)\n *\n * 與 MemberMethodsV11 的差異:\n * - V11: 固定排除函數類型的鍵,只能排除單個鍵\n * - V12: 可自定義值類型條件(如只提取返回 Promise 的方法),支持排除多個鍵\n *\n * 核心機制:\n * ---------------------------\n * 1. 使用 `T extends infer U` 捕獲輸入類型,實現跨模組延遲解析\n * 2. 映射類型遍歷所有鍵,篩選符合 ValueCond 的鍵\n * 3. 若 ExcludeKeys 不為 never,使用 `as` 重映射排除指定鍵\n *\n * ✅ 跨模組驗證:使用 infer 延遲類型解析,即使跨模組引用也能正確運作,\n * 避免 IMethods 變為 string 的問題\n *\n * 使用範例:\n * ---------------------------\n * @example\n * ```typescript\n * interface MyClass {\n * name: string;\n * log(): void;\n * debug(): void;\n * error(): void;\n * constructor(): void;\n * _privateMethod(): void;\n * }\n *\n * // 1. 提取所有方法(預設行為,等同 MemberMethodsV11 無排除時)\n * // ✅ 結果:'log' | 'debug' | 'error' | 'constructor' | '_privateMethod'\n * type AllMethods = MemberMethodsV12<MyClass>;\n *\n * // 2. 提取方法但排除 constructor\n * // ✅ 結果:'log' | 'debug' | 'error' | '_privateMethod'\n * // ❌ 'constructor' 被排除\n * type NoCtor = MemberMethodsV12<MyClass, (...args: any[]) => any, 'constructor'>;\n *\n * // 3. 排除多個鍵\n * // ✅ 結果:'log' | 'debug' | 'error'\n * // ❌ 'constructor'、'_privateMethod' 被排除\n * type PublicMethods = MemberMethodsV12<MyClass, (...args: any[]) => any, 'constructor' | '_privateMethod'>;\n *\n * // 4. 自定義值類型條件 - 只提取返回 string 的方法\n * interface StringReturnClass {\n * getName(): string;\n * getId(): number;\n * log(): void;\n * }\n * // ✅ 結果:'getName'\n * type StringMethods = MemberMethodsV12<StringReturnClass, () => string>;\n *\n * // 5. 自定義值類型 - 只提取返回 Promise 的方法\n * interface AsyncClass {\n * fetchData(): Promise<string>;\n * syncMethod(): string;\n * save(): Promise<void>;\n * }\n * // ✅ 結果:'fetchData' | 'save'\n * type AsyncMethods = MemberMethodsV12<AsyncClass, () => Promise<any>>;\n *\n * // 6. 泛型類別中使用\n * class GenericService<T> {\n * data: T;\n * fetch(): Promise<T>;\n * save(): Promise<void>;\n * private internal(): void;\n * }\n * // ✅ 結果:'fetch' | 'save' | 'internal'(含私有方法)\n * // ❌ 'data' 被過濾(不是函數)\n * type ServiceMethods = MemberMethodsV12<GenericService<any>>;\n * // ✅ 結果:'fetch' | 'save'\n * // ❌ 'internal' 也被排除(假設要排除私有方法)\n * type PublicServiceMethods = MemberMethodsV12<GenericService<any>, (...args: any[]) => any, 'internal'>;\n *\n * // 7. 與 ExtractKeyofV12 組合使用 - 提取並轉換為 string 類型\n * type MyClassMethods = MemberMethodsV12<MyClass>;\n * type StringMethodKeys = ExtractKeyofV12<MyClassMethods, string>; // 'log' | 'debug' | 'error' | ...\n *\n * // 8. 內化排除模式 - 最簡潔用法\n * // 將所有排除邏輯集中在 MemberMethodsV12 的 ExcludeKeys 參數中\n * type CleanMethods = MemberMethodsV12<\n * MyClass,\n * Function,\n * 'constructor' | 'new' | 'prototype' | '_privateMethod'\n * >;\n * ```\n *\n * 進階組合範例:\n * ---------------------------\n * @example\n * ```typescript\n * // 組合 FilterKeys 實現分階段過濾\n * type Stage1 = MemberMethodsV12<ApiA>; // 提取 A 的方法\n * type Stage2 = MemberMethodsV12<ApiB>; // 提取 B 的方法\n * type Combined = FilterKeys<Stage1 | Stage2, 'constructor' | 'init'>;\n *\n * // 條件化排除\n * type ConditionalMethods<T, ExcludePrivate extends boolean> =\n * ExcludePrivate extends true\n * ? MemberMethodsV12<T, (...args: any[]) => any, `_${string}`>\n * : MemberMethodsV12<T>;\n * ```\n *\n * @see ITSExcludeFilterKeys\n * @see ITSExtractKeysV13\n */\nexport type ITSMemberMethodsV12<\n\tT,\n\tValueCond = (...args: any[]) => any,\n\tExcludeKeys extends PropertyKey = never\n>\t// 1. T extends infer U - 使用 infer 捕獲輸入類型,實現延遲解析\n\t= T extends infer U\n\t// 2. U extends object - 確保輸入是對象類型(可遍歷鍵)\n\t? U extends object\n\t\t// 3. ExcludeKeys extends never - 檢查是否需要排除特定鍵\n\t\t? ExcludeKeys extends never\n\t\t\t// 3a. 無需排除 - 使用基本映射類型遍歷所有鍵\n\t\t\t// 遍歷 U 的所有鍵 K,若值類型 U[K] 符合 ValueCond 則保留 K,否則設為 never\n\t\t\t? { [K in keyof U]: U[K] extends ValueCond ? K : never; }[keyof U]\n\t\t\t// 3b. 需要排除 - 使用「as」重映射語法進行鍵過濾\n\t\t\t// 邏輯:先檢查值類型是否符合 ValueCond,再檢查鍵是否在 ExcludeKeys 中\n\t\t\t: {\n\t\t\t\t[K in keyof U as U[K] extends ValueCond\n\t\t\t\t\t// 若值符合條件,進一步檢查鍵是否需要排除\n\t\t\t\t\t? K extends ExcludeKeys ? never : K // 在排除列表中則設為 never,否則保留 K\n\t\t\t\t\t// 若值不符合條件,設為 never(過濾掉)\n\t\t\t\t\t: never]: any\n\t\t\t} extends infer M ? keyof M : never\n\t\t// U 不是 object,返回 never(無法提取方法)\n\t\t: never\n\t// T 無法解析為 infer U,返回 never\n\t: never;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit-index.js","sourceRoot":"","sources":["omit-index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 索引簽名移除工具\n * Index Signature Removal Utilities\n
|
|
1
|
+
{"version":3,"file":"omit-index.js","sourceRoot":"","sources":["omit-index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 索引簽名移除工具\n * Index Signature Removal Utilities\n *\n * 提供移除物件索引簽名的工具類型\n * Provides utility types for removing object index signatures\n */\n\n/**\n * 移除索引簽名\n * Remove index signature\n *\n * 從物件類型中移除索引簽名,保留明確宣告的鍵\n * Removes index signature from object type, keeping explicitly declared keys\n *\n * @see https://stackoverflow.com/a/51956054/4563339\n *\n * @example\n * interface WithIndex {\n * name: string;\n * [key: string]: any;\n * }\n * type WithoutIndex = ITSOmitIndexSignatures<WithIndex>;\n * // type WithoutIndex = { name: string }\n */\nexport type ITSOmitIndexSignatures<T extends Record<any, any>> = {\n\t[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]\n};\n\n/**\n * 取得已知的鍵(排除索引簽名)\n * Get known keys (excluding index signature)\n *\n * @example\n * interface WithIndex {\n * name: string;\n * [key: string]: any;\n * }\n * type Keys = ITSKnownKeys<WithIndex>;\n * // type Keys = \"name\"\n */\nexport type ITSKnownKeys<T extends Record<any, any>> = keyof ITSOmitIndexSignatures<T>;\n\n/**\n * 取得已知的鍵(另一種實現)\n * Get known keys (alternative implementation)\n *\n * @example\n * interface WithIndex {\n * name: string;\n * age: number;\n * [key: string]: any;\n * }\n * type Keys = ITSKnownKeys2<WithIndex>;\n * // type Keys = \"name\" | \"age\"\n */\nexport type ITSKnownKeys2<T> = {\n\t[K in keyof T]: string extends K ? never : number extends K ? never : K\n} extends { [_ in keyof T]: infer U } ? U : never;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.js","sourceRoot":"","sources":["partial.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 記錄部分鍵檢測工具\n * Record Partial Key Detection Utilities\n
|
|
1
|
+
{"version":3,"file":"partial.js","sourceRoot":"","sources":["partial.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 記錄部分鍵檢測工具\n * Record Partial Key Detection Utilities\n *\n * 提供檢測物件鍵是否為可選的工具類型\n * Provides utility types for detecting if object keys are optional\n */\n\n/**\n * 檢測鍵是否為物件的部分鍵(可選鍵)\n * Check if key is a partial key (optional key) of the record\n *\n * 如果排除指定鍵後的類型可以賦值給原始類型,則該鍵為可選鍵\n * If the type after excluding the specified key is assignable to the original type, the key is optional\n *\n * @example\n * interface User {\n * name: string;\n * age?: number;\n * }\n * type PartialKeys = ITSKeyIsPartialOfRecord<User, 'age'>;\n * // type PartialKeys = \"age\"\n *\n * @example\n * interface User {\n * name: string;\n * age: number;\n * }\n * type PartialKeys = ITSKeyIsPartialOfRecord<User, 'age'>;\n * // type PartialKeys = never\n */\nexport type ITSKeyIsPartialOfRecord<T, K extends keyof T> = Omit<T, K> extends T ? K : never;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-type.js","sourceRoot":"","sources":["pick-type.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/2595-medium-pickbytype/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/3814\n */\nimport { ITSNullPrimitive } from '../../type/base';\nimport { ITSValueOf } from '../key-value';\nimport { ITSExclude2, ITSExtract2 } from '../filter';\n\nexport type ITSKeyofByExtractType<T extends Record<keyof any, any>, U, K extends keyof T = keyof T> = K extends keyof T
|
|
1
|
+
{"version":3,"file":"pick-type.js","sourceRoot":"","sources":["pick-type.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/2595-medium-pickbytype/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/3814\n */\nimport { ITSNullPrimitive } from '../../type/base';\nimport { ITSValueOf } from '../key-value';\nimport { ITSExclude2, ITSExtract2 } from '../filter';\n\nexport type ITSKeyofByExtractType<T extends Record<keyof any, any>, U, K extends keyof T = keyof T> = K extends keyof T\n\t? T[K] extends U ? K : never\n\t: never;\n\n/**\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/2595-medium-pickbytype/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/3814\n */\nexport type ITSKeyofByExcludeType<T extends Record<keyof any, any>, U, K extends keyof T = keyof T> = K extends keyof T\n\t? T[K] extends U ? never : K\n\t: never;\n\n/**\n * From `T`, pick a set of properties whose type are assignable to `U`.\n *\n * @example\ntype OmitBoolean = ITSPickByType<{\n name: string\n count: number\n isReadonly: boolean\n isEnable: boolean\n}, boolean>\n *\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/2595-medium-pickbytype/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/3814\n */\nexport type ITSPickByType<T extends Record<keyof any, any>, U, K extends keyof T = keyof T> = {\n\t[P in ITSKeyofByExtractType<T, U, K>]: T[P]\n}\n\n/**\n * From `T`, pick a set of properties whose type are not assignable to `U`.\n *\n * @example\ntype OmitBoolean = ITSOmitByType<{\n name: string\n count: number\n isReadonly: boolean\n isEnable: boolean\n}, boolean>\n *\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/2595-medium-pickbytype/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/3814\n */\nexport type ITSOmitByType<T extends Record<keyof any, any>, U, K extends keyof T = keyof T> = {\n\t[P in ITSKeyofByExcludeType<T, U, K>]: T[P]\n}\n\n/**\n * @internal\n */\nexport type ITSRecordExcludeToKey<Base, Type> = {\n\t[Key in keyof Base]: ITSExclude2<Base[Key], Type, Key>\n};\n/**\n * @internal\n */\nexport type ITSRecordExtractToKey<Base, Type> = {\n\t[Key in keyof Base]: ITSExtract2<Base[Key], Type, Key>\n};\n\nexport type ITSKeyOfRecordExcludeToKey<Base, Type> = ITSValueOf<ITSRecordExcludeToKey<Base, Type>>;\nexport type ITSKeyOfRecordExtractToKey<Base, Type> = ITSValueOf<ITSRecordExtractToKey<Base, Type>>;\n\nexport type ITSPickRecordType<Base, Type> = Pick<Base, ITSKeyOfRecordExtractToKey<Base, Type>>;\nexport type ITSOmitRecordType<Base, Type> = Pick<Base, ITSKeyOfRecordExcludeToKey<Base, Type>>;\n\n/**\n * @deprecated use `ITSPickByType<M, T, K>`\n */\nexport type ITSExtractRecord<M, T, K extends keyof M = keyof M> = ITSPickByType<M, T, K>\n\nexport type ITSExtractRecordNoNull<M, T, K extends keyof M = keyof M> = {\n\t[P in K]: NonNullable<M[P]>;\n};\n\n/**\n * @deprecated use `ITSOmitByType<M, T, K>`\n */\nexport type ITSExcludeRecord<M, T, K extends keyof M = keyof M> = ITSOmitByType<M, T, K>;\n\nexport type ITSExcludeRecordNoNull<M, T, K extends keyof M = keyof M> = ITSOmitByType<M, ITSNullPrimitive, K>;\n\n/**\n * @deprecated use `ITSKeyofByExtractType<T, U, K>`\n */\nexport type ITSExtractKeyofRecord<M, T, K extends keyof M = keyof M> = ITSKeyofByExtractType<M, T, K>;\n\n/**\n * @deprecated use `ITSKeyofByExcludeType<M, T, K>`\n */\nexport type ITSExcludeKeyofRecord<M, T, K extends keyof M = keyof M> = ITSKeyofByExcludeType<M, T, K>;\n"]}
|
package/lib/helper/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 記錄(Record)類型操作工具\n * Record Type Manipulation Utilities\n
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 記錄(Record)類型操作工具\n * Record Type Manipulation Utilities\n *\n * 提供物件鍵盤操作的工具類型\n * Provides utility types for object key manipulation\n *\n * @see https://stackoverflow.com/a/55479659/4563339\n */\n\nexport type { ITSKeyIsPartialOfRecord } from './record/partial';\n\n/**\n * 取得物件的唯讀鍵集合\n * Get the readonly keys of an object\n *\n * 回傳一個由物件所有唯讀鍵組成的聯集類型\n * Returns a union type consisting of all readonly keys of the object\n *\n * @see https://github.com/type-challenges/type-challenges/blob/master/questions/5-extreme-readonly-keys/README.md\n * @see https://github.com/type-challenges/type-challenges/issues/87\n *\n * @alias ITSGetReadonlyKeys\n *\n * @example\n * interface Todo {\n * readonly title: string\n * readonly description: string\n * completed: boolean\n * }\n * type Keys = ITSKeyOfRecordExtractReadonly<Todo>\n * // expected to be \"title\" | \"description\"\n */\nexport type ITSKeyOfRecordExtractReadonly<T> = {\n\t[K in keyof T]-?: (<U>() => U extends { -readonly [P in K]: T[K] }\n\t\t? 1\n\t\t: 2) extends (<U>() => U extends { [P in K]: T[K] } ? 1 : 2) ? never : K\n}[keyof T];\n\n/** 取得物件的唯讀鍵集合(別名)/ Get the readonly keys of an object (alias) */\nexport type { ITSKeyOfRecordExtractReadonly as ITSGetReadonlyKeys }\n\n/**\n * 取得物件的非唯讀鍵集合\n * Get the non-readonly keys of an object\n *\n * 回傳一個由物件所有可寫入鍵組成的聯集類型\n * Returns a union type consisting of all writable keys of the object\n *\n * @example\n * interface Todo {\n * readonly title: string\n * readonly description: string\n * completed: boolean\n * }\n * type Keys = ITSKeyOfRecordExcludeReadonly<Todo>\n * // expected to be \"completed\"\n */\nexport type ITSKeyOfRecordExcludeReadonly<T> = Exclude<keyof T, ITSKeyOfRecordExtractReadonly<T>>\n\n/**\n * 檢查指定鍵是否為物件的唯讀鍵\n * Check if the specified key is a readonly key of the object\n *\n * @example\n * interface Todo {\n * readonly title: string\n * completed: boolean\n * }\n * type IsReadonly = ITSKeyIsReadonlyOfRecord<Todo, 'title'>;\n * // type IsReadonly = \"title\"\n */\nexport type ITSKeyIsReadonlyOfRecord<T, K extends ITSKeyOfRecordExtractReadonly<T>> = Extract<K, ITSKeyOfRecordExtractReadonly<T>>;\n\n/**\n * 檢查指定鍵是否為物件的非唯讀鍵\n * Check if the specified key is a non-readonly key of the object\n *\n * @example\n * interface Todo {\n * readonly title: string\n * completed: boolean\n * }\n * type IsWritable = ITSKeyIsNotReadonlyOfRecord<Todo, 'completed'>;\n * // type IsWritable = \"completed\"\n */\nexport type ITSKeyIsNotReadonlyOfRecord<T, K extends ITSKeyOfRecordExcludeReadonly<T>> = Extract<K, ITSKeyOfRecordExcludeReadonly<T>>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer.js","sourceRoot":"","sources":["infer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串類型推斷工具\n * String Type Inference Utilities\n
|
|
1
|
+
{"version":3,"file":"infer.js","sourceRoot":"","sources":["infer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串類型推斷工具\n * String Type Inference Utilities\n *\n * 提供從字串字面量類型推斷基礎類型的工具\n * Provides utilities for inferring base types from string literal types\n */\n\nimport { ITSToStringLiteralAllowedType } from '../string';\n\n/**\n * 從字串推斷指定類型\n * Infer specified type from string\n *\n * 嘗試將字串字面量類型推斷為指定的基礎類型\n * Attempts to infer a specified base type from a string literal type\n *\n * @example\n * type Num = ITSStringInferToType<'123', number>;\n * // type Num = 123\n *\n * @example\n * type Bool = ITSStringInferToType<'true', boolean>;\n * // type Bool = true\n */\nexport type ITSStringInferToType<Str extends string, Type extends ITSToStringLiteralAllowedType, R = never> =\n\tStr extends `${infer U extends Type}`\n\t\t? U\n\t\t: R;\n\n/**\n * 從字串推斷數字類型\n * Infer number type from string\n *\n * @example\n * type Num = ITSStringInferToNumber<'123'>;\n * // type Num = 123\n */\nexport type ITSStringInferToNumber<Str extends string, R = never> = ITSStringInferToType<Str, number, R>\n\n/**\n * 從字串推斷布林類型\n * Infer boolean type from string\n *\n * @example\n * type Bool = ITSStringInferToBoolean<'true'>;\n * // type Bool = true\n */\nexport type ITSStringInferToBoolean<Str extends string, R = never> = ITSStringInferToType<Str, boolean, R>\n\n/**\n * 從字串推斷 null 類型\n * Infer null type from string\n *\n * @example\n * type Null = ITSStringInferToNull<'null'>;\n * // type Null = null\n */\nexport type ITSStringInferToNull<Str extends string, R = never> = ITSStringInferToType<Str, null, R>\n\n/**\n * 從字串推斷 undefined 類型\n * Infer undefined type from string\n *\n * @example\n * type Undefined = ITSStringInferToUndefined<'undefined'>;\n * // type Undefined = undefined\n */\nexport type ITSStringInferToUndefined<Str extends string, R = never> = ITSStringInferToType<Str, undefined, R>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal-string.js","sourceRoot":"","sources":["literal-string.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串大小寫轉換工具\n * String Case Conversion Utilities\n
|
|
1
|
+
{"version":3,"file":"literal-string.js","sourceRoot":"","sources":["literal-string.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串大小寫轉換工具\n * String Case Conversion Utilities\n *\n * 提供字串命名字面量的大小寫轉換工具\n * Provides string naming literal case conversion utilities\n */\n\n/**\n * 將連字符命名字符串轉換為 PascalCase\n * Convert kebab-case string literal to PascalCase\n *\n * @see yargs\n *\n * @example\n * type Result = ITSPascalCase<'foo-bar'>;\n * // type Result = \"FooBar\"\n *\n * @example\n * type Result = ITSPascalCase<'foo-bar-baz'>;\n * // type Result = \"FooBarBaz\"\n */\nexport type ITSPascalCase<S extends string> = string extends S\n\t? string\n\t: S extends `${infer T}-${infer U}`\n\t\t? `${Capitalize<T>}${ITSPascalCase<U>}`\n\t\t: Capitalize<S>;\n\n/**\n * 將連字符命名字符串轉換為 camelCase\n * Convert kebab-case string literal to camelCase\n *\n * @see yargs\n *\n * @example\n * type Result = ITSCamelCase<'foo-bar'>;\n * // type Result = \"fooBar\"\n *\n * @example\n * type Result = ITSCamelCase<'foo-bar-baz'>;\n * // type Result = \"fooBarBaz\"\n */\nexport type ITSCamelCase<S extends string> = string extends S\n\t? string\n\t: S extends `${infer T}-${infer U}`\n\t\t? `${T}${ITSPascalCase<U>}`\n\t\t: S;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["operations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串操作工具\n * String Operation Utilities\n
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["operations.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字串操作工具\n * String Operation Utilities\n *\n * 提供字串相關的類型操作工具\n * Provides string-related type manipulation utilities\n */\n\n/**\n * 字串首字母大寫\n * Capitalize first letter of string\n *\n * @example\n * type Result = ITSCapitalize<'hello'>; // 'Hello'\n * type Result2 = ITSCapitalize<'world'>; // 'World'\n */\nexport type ITSCapitalize<S extends string> = S extends `${infer First}${infer Rest}`\n\t? `${Uppercase<First>}${Rest}`\n\t: S;\n\n/**\n * 字串首字母小寫\n * Uncapitalize first letter of string\n *\n * @example\n * type Result = ITSUncapitalize<'Hello'>; // 'hello'\n * type Result2 = ITSUncapitalize<'World'>; // 'world'\n */\nexport type ITSUncapitalize<S extends string> = S extends `${infer First}${infer Rest}`\n\t? `${Lowercase<First>}${Rest}`\n\t: S;\n\n/**\n * 字串轉為大寫\n * Convert string to uppercase\n *\n * @example\n * type Result = ITSToUpperCase<'hello'>; // 'HELLO'\n * type Result2 = ITSToUpperCase<'World'>; // 'WORLD'\n */\nexport type ITSToUpperCase<S extends string> = Uppercase<S>;\n\n/**\n * 字串轉為小寫\n * Convert string to lowercase\n *\n * @example\n * type Result = ITSToLowerCase<'HELLO'>; // 'hello'\n * type Result2 = ITSToLowerCase<'World'>; // 'world'\n */\nexport type ITSToLowerCase<S extends string> = Lowercase<S>;\n\n/**\n * TODO: 字串重複指定次數 - 無法實現\n * Repeat string specified number of times\n *\n * TypeScript 無法在類型層級進行遞迴數學運算\n * TypeScript cannot perform recursive mathematical operations at type level\n *\n * @example\n * type Result = ITSRepeat<'abc', 3>; // 'abcabcabc'\n * type Result2 = ITSRepeat<'x', 5>; // 'xxxxx'\n */\n// export type ITSRepeat<S extends string, N extends number> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSRepeat<S extends string, N extends number> = \n// \tN extends 0 \n// \t\t? '' \n// \t\t: N extends infer Count \n// \t\t\t? Count extends number \n// \t\t\t\t? `${S}${ITSRepeat<S, Count extends 0 ? never : Count - 1>}`\n// \t\t\t\t: never \n// \t\t\t: never;\n\n/**\n * TODO: 字串長度 - 無法實現\n * Get string length\n *\n * TypeScript 無法在類型層級計算字串長度\n * TypeScript cannot calculate string length at type level\n *\n * @example\n * type Result = ITSStringLength<'hello'>; // 5\n * type Result2 = ITSStringLength<''>; // 0\n */\n// export type ITSStringLength<S extends string> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSStringLength<S extends string, Counter extends any[] = []> = \n// \tS extends `${string}${infer Rest}` \n// \t\t? ITSStringLength<Rest, [...Counter, any]>\n// \t\t: Counter['length'];\n\n/**\n * TODO: 字串分割 - 無法實現\n * Split string by separator\n *\n * TypeScript 無法在類型層級進行字串分割操作\n * TypeScript cannot perform string splitting operations at type level\n *\n * @example\n * type Result = ITSSplit<'a,b,c', ','>; // ['a', 'b', 'c']\n * type Result2 = ITSSplit<'hello world', ' '>; // ['hello', 'world']\n */\n// export type ITSSplit<S extends string, Separator extends string> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSSplit<S extends string, Separator extends string> = \n// \tS extends `${infer First}${Separator}${infer Rest}`\n// \t\t? [First, ...ITSSplit<Rest, Separator>]\n// \t\t: [S];\n\n/**\n * TODO: 字串連接 - 無法實現\n * Join string array with separator\n *\n * TypeScript 無法在類型層級進行陣列連接操作\n * TypeScript cannot perform array joining operations at type level\n *\n * @example\n * type Result = ITSJoin<['a', 'b', 'c'], ','>; // 'a,b,c'\n * type Result2 = ITSJoin<['hello', 'world'], ' '>; // 'hello world'\n */\n// export type ITSJoin<T extends string[], Separator extends string> = never;\n\n// 保留原始實現作為參考 / Keep original implementation for reference\n// export type ITSJoin<T extends string[], Separator extends string> = \n// \tT extends [infer First, ...infer Rest]\n// \t\t? First extends string\n// \t\t\t? Rest extends string[]\n// \t\t\t\t? Rest['length'] extends 0\n// \t\t\t\t\t? First\n// \t\t\t\t\t: `${First}${Separator}${ITSJoin<Rest, Separator>}`\n// \t\t\t\t: never\n// \t\t\t: never\n// \t\t: '';\n\n/**\n * 字串替換\n * Replace substring in string\n *\n * @example\n * type Result = ITSReplace<'hello world', 'world', 'typescript'>; // 'hello typescript'\n * type Result2 = ITSReplace<'abc123', '123', '456'>; // 'abc456'\n */\nexport type ITSReplace<S extends string, Search extends string, Replace extends string> =\n\tS extends `${infer Prefix}${Search}${infer Suffix}`\n\t\t? `${Prefix}${Replace}${Suffix}`\n\t\t: S;\n\n/**\n * 字串是否包含子字串\n * Check if string contains substring\n *\n * @example\n * type Result = ITSIncludes<'hello world', 'world'>; // true\n * type Result2 = ITSIncludes<'hello world', 'typescript'>; // false\n */\nexport type ITSIncludes<S extends string, Search extends string> =\n\tS extends `${string}${Search}${string}` ? true : false;\n\n/**\n * 字串是否以指定前綴開始\n * Check if string starts with prefix\n *\n * @example\n * type Result = ITSStartsWith<'hello world', 'hello'>; // true\n * type Result2 = ITSStartsWith<'hello world', 'world'>; // false\n */\nexport type ITSStartsWith<S extends string, Prefix extends string> =\n\tS extends `${Prefix}${string}` ? true : false;\n\n/**\n * 字串是否以指定後綴結束\n * Check if string ends with suffix\n *\n * @example\n * type Result = ITSEndsWith<'hello world', 'world'>; // true\n * type Result2 = ITSEndsWith<'hello world', 'hello'>; // false\n */\nexport type ITSEndsWith<S extends string, Suffix extends string> =\n\tS extends `${string}${Suffix}` ? true : false;\n"]}
|
package/lib/helper/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字面量類型工具\n * Literal Type Utilities\n
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 字面量類型工具\n * Literal Type Utilities\n *\n * 提供字串、數字、布林值轉換為字面量類型的工具\n * Provides utilities for converting strings, numbers, booleans to literal types\n */\n\n/** 允許轉換為字面量類型的基礎類型 / Base types allowed to convert to literal types */\nexport type ITSToStringLiteralAllowedType = string | number | boolean | bigint;\n\n/**\n * 將類型轉換為字面量類型 `${T}`\n * Convert type to literal type `${T}`\n *\n * @example\n * type Str = ITSToStringLiteral<'hello'>;\n * // type Str = \"hello\"\n *\n * @example\n * type Num = ITSToStringLiteral<42>;\n * // type Num = \"42\"\n */\nexport type ITSToStringLiteral<T extends ITSToStringLiteralAllowedType> = `${T}`\n\n/**\n * 原始類型與其字面量類型的聯合\n * Union of original type and its literal type\n *\n * T & `${T}`\n *\n * 適合用在 enum 或 string literal union,可以接受 enum 的字面量或基底類型\n * Suitable for enum or string literal union, can accept enum literal or base type\n *\n * @example\n * // 應用於 string literal union\n * type Status = 'active' | 'inactive' | 'pending';\n * type IStatus = ITSTypeAndStringLiteral<Status>;\n * // type IStatus = \"active\" | \"inactive\" | \"pending\" | string\n *\n * @example\n * // 應用於 enum\n * enum EnumPackageManager {\n * 'yarn' = 'yarn',\n * 'npm' = 'npm',\n * 'pnpm' = 'pnpm',\n * }\n * type IPackageManager = ITSTypeAndStringLiteral<EnumPackageManager>;\n * // type IPackageManager = EnumPackageManager | string\n *\n * @example\n * // 應用於 number,可接受數字或數字字串\n * type INumber = ITSTypeAndStringLiteral<number>;\n * // type INumber = number | `${number}`\n */\nexport type ITSTypeAndStringLiteral<T extends ITSToStringLiteralAllowedType> = T | ITSToStringLiteral<T>\n\n/**\n * 原始類型 S 與 T 的字面量類型的聯合\n * Union of original type S and literal type of T\n *\n * S & `${T}`\n *\n * @example\n * type Result = ITSAndStringLiteral<1 | 2 | 3, number>;\n * // type Result = number | \"1\" | \"2\" | \"3\"\n */\nexport type ITSAndStringLiteral<T extends ITSToStringLiteralAllowedType, S = string> = S | ITSToStringLiteral<T>\n\n/**\n * 原始類型 S、T 與 T 的字面量類型的聯合\n * Union of original types S, T and literal type of T\n *\n * S & T & `${T}`\n *\n * @example\n * type Result = ITSAndTypeAndStringLiteral<1 | 2 | 3, number>;\n * // type Result = number | \"1\" | \"2\" | \"3\"\n */\nexport type ITSAndTypeAndStringLiteral<T extends ITSToStringLiteralAllowedType, S = string> =\n\tS\n\t| ITSTypeAndStringLiteral<T>\n"]}
|
package/lib/helper/tuple.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuple.js","sourceRoot":"","sources":["tuple.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 元組類型工具\n * Tuple Type Utilities\n
|
|
1
|
+
{"version":3,"file":"tuple.js","sourceRoot":"","sources":["tuple.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 元組類型工具\n * Tuple Type Utilities\n *\n * 提供元組相關的類型操作工具\n * Provides tuple-related type manipulation utilities\n */\n\n/**\n * 取得元組的數字索引鍵\n * Get numeric index keys of a tuple\n *\n * 回傳元組的所有數字索引(不包括陣列方法如 length、push 等)\n * Returns all numeric indices of the tuple (excluding array methods like length, push, etc.)\n *\n * @example\n * type Keys = ITSTupleKeys<[string, string, string]>;\n * // type Keys = \"0\" | \"1\" | \"2\"\n *\n * @see https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection-type\n */\nexport type ITSTupleKeys<T extends any[]> = Exclude<keyof T, keyof []>\n"]}
|
package/lib/helper/typeof.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeof.js","sourceRoot":"","sources":["typeof.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 類型推断工具\n * Type Inference Utilities\n
|
|
1
|
+
{"version":3,"file":"typeof.js","sourceRoot":"","sources":["typeof.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * 類型推断工具\n * Type Inference Utilities\n *\n * 提供迭代器和其他類型相關的工具類型\n * Provides iterator and other type-related utility types\n *\n * Created by user on 2019/6/11.\n */\n\n/**\n * 迭代器類型\n * Iterator type\n *\n * 處理 Iterator 或 IteratorResult 類型,保留其原始結構\n * Handles Iterator or IteratorResult types, preserving their original structure\n *\n * @example\n * type LazyIterator = ITSIteratorLazy<Iterator<string>>;\n * // type LazyIterator = Iterator<string>\n */\nexport type ITSIteratorLazy<T extends Iterator<any> | IteratorResult<any>> =\n\tT extends IteratorResult<infer U> ? IteratorResult<U> :\n\t\tT extends Iterator<infer U> ? Iterator<U> :\n\t\t\tT\n\t;\n\n/**\n * 取得迭代器的值類型\n * Get the value type of an iterator\n *\n * 從 Iterator 或 IteratorResult 類型中提取值類型\n * Extracts the value type from Iterator or IteratorResult types\n *\n * @see https://stackoverflow.com/questions/49285864/is-there-a-valueof-similar-to-keyof-in-typescript\n *\n * @example\n * type IteratorValue = ITSTypeOfIterator<Iterator<string>>;\n * // type IteratorValue = string\n *\n * @example\n * type IteratorResultValue = ITSTypeOfIterator<IteratorResult<number>>;\n * // type IteratorResultValue = number\n */\nexport type ITSTypeOfIterator<T extends ITSIteratorLazy<any>> =\n\tT extends Iterator<infer U> ? U :\n\t\tT extends IteratorResult<infer U> ? U :\n\t\t\tany\n\t;\n"]}
|
package/lib/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["helper.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSArrayListMaybeReadonly } from './type/base';\nimport { ITSAwaitedReturnType } from './helper/promise';\n\n
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["helper.ts"],"names":[],"mappings":"","sourcesContent":["import { ITSArrayListMaybeReadonly } from './type/base';\nimport { ITSAwaitedReturnType } from './helper/promise';\n\n/**\n * 複製當前函數的參數並返回新的值類型\n * Copy current function with Parameters and return to new value\n *\n * 不支援函數重載\n * Not support overload\n *\n * @example\n * declare function f(a: number): number\n * declare let c: ITSOverwriteReturnType<typeof f, string>;\n * // c = (a: number) => string\n */\nexport type ITSOverwriteReturnType<T extends (...args: any[]) => any, R extends unknown> =\n\t(...args: Parameters<T>) => R;\n\n/**\n * 將函數包裝為返回 PromiseLike 的版本\n * Wrap function to return PromiseLike version\n */\nexport type ITSWrapFunctionPromiseLike<T extends (...args: any[]) => any> =\n\t(...args: Parameters<T>) => PromiseLike<ITSAwaitedReturnType<T>>;\n/**\n * 將函數包裝為返回 Promise 的版本\n * Wrap function to return Promise version\n */\nexport type ITSWrapFunctionPromise<T extends (...args: any[]) => any> =\n\t(...args: Parameters<T>) => Promise<ITSAwaitedReturnType<T>>;\n\n/**\n * 擴展類型檢查:從 T 中提取屬於 U 的部分\n * Extend type check: extract parts of T that belong to U\n *\n * @deprecated 已棄用 / Deprecated\n */\nexport type ITSExtendsOf<T, U> = Extract<T, U>;\n\n/**\n * 取得陣列類型的數字索引鍵\n * Get numeric index keys of array type\n */\nexport type ITSKeyOfArray<T extends ITSArrayListMaybeReadonly<any>> = Exclude<keyof T, symbol | string>;\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["filter.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 內部過濾工具(內部使用)\n * Internal Filter Utilities (Internal Use)\n
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["filter.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG","sourcesContent":["/**\n * 內部過濾工具(內部使用)\n * Internal Filter Utilities (Internal Use)\n *\n * 提供內部使用的過濾類型工具\n * Provides internal filter type utilities\n */\n\nimport { ITSExtract2 } from '../helper/filter';\n\n/**\n * 根據匹配鍵過濾記錄(內部使用)\n * Filter record by matching keys (internal use)\n *\n * @internal\n */\ntype I_RecordOfMatchKey<M, T, K extends keyof M = keyof M> = {\n\t[P in K]: ITSExtract2<M[P], T, P>;\n};\n\n/**\n * 根據匹配值過濾記錄(內部使用)\n * Filter record by matching values (internal use)\n *\n * @internal\n */\ntype I_RecordOfMatchValue<M, T, K extends keyof M = keyof M> = {\n\t[P in K]: ITSExtract2<M[P], T>;\n};\n"]}
|