refactor: remove ts-toolbelt dependency#53
Open
regevbr wants to merge 1 commit into
Open
Conversation
Replace all ts-toolbelt utilities with native TypeScript built-ins and custom implementations while maintaining 100% type safety. Changes: - Create src/types/utils.ts with custom type utilities (Primitive, BuiltIn, List, Cast, Keys, Compute, Split, Join, Path, FilterNever, NonNullableFlat, RequireOnlyOne) - Replace ts-toolbelt imports in paths.ts, required.ts, evaluator.ts, and expressionParts.ts - Replace Any.Key with PropertyKey in helpers.ts - Add type assertion in engine.ts for RuleDefinition narrowing - Update test file to use custom Compute type - Remove ts-toolbelt from dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
❌ 4 blocking issues (4 total)
|
| ? Exclude<keyof A, keyof any[]> | number | ||
| : keyof A; | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type | ||
| export type Compute<A> = A extends Function ? A : { [K in keyof A]: A[K] } & unknown; |
| // NonNullableFlat - makes properties non-nullable at top level | ||
| export type NonNullableFlat<O> = { | ||
| [K in keyof O]: NonNullable<O[K]>; | ||
| } & {}; |
| // Pick helper - matches ts-toolbelt's _Pick | ||
| type _Pick<O extends object, K extends PropertyKey> = { | ||
| [P in keyof O & K]: O[P]; | ||
| } & {}; |
| // OptionalFlat - matches ts-toolbelt's OptionalFlat | ||
| type OptionalFlat<O> = { | ||
| [K in keyof O]?: O[K]; | ||
| } & {}; |
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (2)
🛟 Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
ts-toolbeltdependency by replacing all utilities with native TypeScript built-ins and custom implementationsChanges
New file:
src/types/utils.tsCustom type utilities replacing ts-toolbelt:
Primitive,BuiltIn- Type categoriesList,Cast,Keys,Compute- Any/list utilitiesSplit,Join- String utilitiesPath,FilterNever,NonNullableFlat- Object utilitiesRequireOnlyOne- Replacement forObject.EitherModified files
src/types/paths.ts./utilssrc/types/required.tsMisc.BuiltIn→BuiltInsrc/types/evaluator.tsRequireOnlyOnesrc/types/expressionParts.tsParameterssrc/lib/helpers.tsAny.Key→PropertyKeysrc/lib/engine.tsRuleDefinitionnarrowingsrc/test/types/expressionParts.tsAny.Compute→Computepackage.jsonts-toolbeltdependencyTest plan
pnpm run ci)🤖 Generated with Claude Code