Skip to content

Meta interface#826

Merged
johngeorgewright merged 11 commits into
masterfrom
simple-typing
Dec 12, 2025
Merged

Meta interface#826
johngeorgewright merged 11 commits into
masterfrom
simple-typing

Conversation

@johngeorgewright

Copy link
Copy Markdown
Collaborator

Extending maintainability by passing around a Meta interface instead of declaring each set of parsers separately.

Prior to the Meta ($) type, the Data class was difficult to maintain. Everytime a new feature was added every reference needed to change. We now contain all the Data generics in an interface.

BREAKING CHANGE: Data generics have changed.
Prior to the Meta ($) type, the Data class was difficult to maintain. Everytime a new feature was added every reference needed to change. We now contain all the Data generics in an interface.

BREAKING CHANGE: Data generics have changed.
Prior to the Meta ($) type, the Data class was difficult to maintain. Everytime a new feature was added every reference needed to change. We now contain all the Data generics in an interface.

BREAKING CHANGE: Data generics have changed.
Prior to the Meta ($) type, the Data class was difficult to maintain. Everytime a new feature was added every reference needed to change. We now contain all the Data generics in an interface.

BREAKING CHANGE: Data generics have changed.
Keep things simple and use a full meta interface

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Meta interface to consolidate type parameters, reducing code duplication and improving maintainability. Instead of passing four separate parser type parameters (PayloadParsers, TargetingParsers, QueryParsers, FallThroughTargetingParsers) throughout the codebase, a single Meta interface encapsulates all four.

Key changes:

  • Introduced DT.Meta interface with four parser type properties
  • Refactored generic type parameters across the codebase to use $ extends DT.Meta
  • Simplified type definitions by accessing parser types through the Meta interface (e.g., $['PayloadParsers'])

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/api/src/types/Data.ts Added Meta and EmptyMeta interfaces; refactored type helper functions to use the new Meta pattern
packages/api/src/types/Payload.ts Updated Payload and Payloads types to use Meta interface
packages/api/src/types/FallThroughTargeting.ts Updated Rules type to use Meta interface
packages/api/src/parsers/DataItemRule.ts Refactored all parser and rule types to use Meta interface instead of separate type parameters
packages/api/src/parsers/DataItemRules.ts Updated parser function and types to use Meta interface
packages/api/src/parsers/DataItem.ts Updated DataItem parser and types to use Meta interface
packages/api/src/parsers/DataItemVariablesParser.ts Refactored to use Meta interface for targeting parsers
packages/api/src/parsers/DataItems.ts Updated to use Meta interface and added ObjValues helper type
packages/api/src/parsers/TargetingPredicates.ts Updated to use Meta interface with Pick for required parser types
packages/api/src/Data.ts Refactored Data class to use Meta interface throughout
packages/api/src/PromisedData.ts Updated PromisedData class to use Meta interface and implement new IData interface
packages/api/src/IData.ts Added new interface defining the Data API contract using Meta interface
packages/client/src/index.ts Simplified Client class to use Meta interface; streamlined ClientWithData type
packages/server/src/middleware/castQueryProp.ts Added generic type parameters and exported ParsedQs type
packages/server/src/middleware/castQueryArrayProps.ts Updated to use DT.Any and simplified type parameters
packages/api/src/types.ts Added ObjValues utility type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@johngeorgewright johngeorgewright merged commit 7ac864a into master Dec 12, 2025
1 check passed
@johngeorgewright johngeorgewright deleted the simple-typing branch December 12, 2025 09:21
@johngeorgewright

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version @targetd/api-v8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants