feat(type): support intrinsics Capitalize, Uppercase, Lowercase, Uncapitalize#681
Merged
feat(type): support intrinsics Capitalize, Uppercase, Lowercase, Uncapitalize#681
Conversation
…pitalize
supports now expressions like these
```typescript
type A = `Prefix_${Uppercase<'hello' | 'world'>}_Suffix`
```
which will be expanded to
```typescript
type T = 'Prefix_HELLO_Suffix' | 'Prefix_WORLD_Suffix'
```
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for TypeScript's built-in string manipulation intrinsic types (Uppercase, Lowercase, Capitalize, and Uncapitalize) to the Deepkit type system. These intrinsics enable compile-time string transformations in the type reflection system.
- Implements handling for the four string intrinsic types in both the compiler and runtime processor
- Adds comprehensive test coverage for basic functionality including unions and template literals
- Extends the
extractPackStructOfTypeReferencemethod signature to acceptIdentifiertypes for intrinsic processing
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/type/tests/intrinsics.spec.ts | New test file covering basic intrinsic operations, unions, and template literal integration |
| packages/type/src/reflection/type.ts | Adds a debugger statement (should be removed) in template literal stringification |
| packages/type/src/reflection/processor.ts | Implements runtime handling for intrinsic operations with helper functions for each type, adds missing semicolon |
| packages/type-spec/src/type.ts | Defines TypeIntrinsic enum and adds intrinsic operation to ReflectionOp |
| packages/type-compiler/tests/transpile.spec.ts | Adds transpilation test for intrinsic types |
| packages/type-compiler/src/compiler.ts | Implements compiler support for detecting and processing intrinsic keywords, refactors extractPackStructOfTypeReference to handle identifiers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
amazing thank you for doing that so quickly! fully missed your discord chat but really appreciate the assistance :D |
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.
Supports now expressions like these
which will be expanded to