Repository navigation
feat(types): add basic pattern types - #41
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces pattern-aware TypeScript type generation for JSON Schema pattern constraints, aiming to produce more specific string types (notably via template literal types) instead of plain string.
Changes:
- Added a new
generateTypeFromPattern()utility to convert regex patterns into TypeScriptTypeNodes. - Integrated
patternhandling into JSON Schema string type generation. - Added Jest tests and updated existing snapshots/output expectations; introduced
regexppas a dependency.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/patterns.ts | New utility for deriving TypeScript types from regex patterns. |
| src/utils/patterns.test.ts | New Jest test coverage for the pattern-to-type generator. |
| src/utils/jsonSchema.ts | Hooks pattern-derived types into JSON Schema string handling. |
| src/index.test.ts | Snapshot/output updates affected by new type generation behavior. |
| src/snapshots/index.test.ts.snap | Updated snapshots showing refined string/template literal types. |
| package.json | Adds regexpp dependency. |
| package-lock.json | Locks regexpp dependency version and metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 5, 2026 08:07
f1c2a48 to
93bcd54
Compare
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 5, 2026 09:01
93bcd54 to
0245159
Compare
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 5, 2026 11:59
0245159 to
d23b1a3
Compare
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 5, 2026 12:08
d23b1a3 to
ff94a5f
Compare
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 6, 2026 10:12
023ef80 to
ac99e74
Compare
nfroidure
force-pushed
the
feat/pattern_types
branch
from
June 8, 2026 08:01
ac99e74 to
969919a
Compare
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.
No description provided.