Skip to content

feat/typing#34

Merged
allanhvam merged 3 commits into
mainfrom
feat/typing
Feb 11, 2026
Merged

feat/typing#34
allanhvam merged 3 commits into
mainfrom
feat/typing

Conversation

@allanhvam
Copy link
Copy Markdown
Owner

No description provided.

@allanhvam allanhvam requested a review from Copilot February 11, 2026 12:49
Copy link
Copy Markdown

Copilot AI left a comment

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 improved TypeScript typing for workflow services by extracting only public parts of service classes and supporting PromiseLike return types in addition to Promise types.

Changes:

  • Added PublicPart utility type to map services to their public interfaces only
  • Extended OnlyAsync type to support both Promise and PromiseLike return types
  • Updated .npmignore patterns for better build artifact exclusion

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types/PublicPart.ts New utility type to extract public members from service types
src/workflows/index.ts Applied PublicPart typing to service parameters in workflow run methods
src/types/OnlyAsync.ts Extended type check to include PromiseLike alongside Promise
src/tests/workflows/public-part.ts Test case demonstrating public-only service interface usage
src/tests/workflows/promise-like.ts Test case for PromiseLike return type support
src/tests/workflows.test.ts Added test assertions for new public-part and promise-like workflows
package.json Version bump to 0.6.1
.npmignore Updated ignore patterns for debug files and eslint configurations

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

Comment thread src/types/PublicPart.ts
@@ -0,0 +1,4 @@
/**
* @internal
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The PublicPart type implementation is identical to TypeScript's built-in mapped type and doesn't actually filter out private members. TypeScript's type system doesn't have runtime visibility into public/private modifiers, so this type provides no actual filtering functionality. Consider renaming to reflect its actual behavior (e.g., ServiceInterface) or documenting that it serves as a semantic marker for service interfaces rather than an enforcer of visibility.

Suggested change
* @internal
* @internal
*
* Semantic alias for the "public interface" of a type.
*
* Note: This type does **not** filter out private or protected members.
* TypeScript's type system has no runtime notion of visibility modifiers,
* so this is effectively an identity mapped type:
*
* { [K in keyof T]: T[K] }
*
* Use this as a documentation aid to indicate that a type represents
* the externally visible shape of a service or API, not as an enforcer
* of public/private boundaries.

Copilot uses AI. Check for mistakes.
// Assert
assert.ok(result);
assert.ok(result.id);
assert.equal(result.result, 3);
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The test expects result to be 3, but the mock implementation in the test only adds x + y (1 + 2 = 3), while the actual MathService.add method includes + await this.z() which returns 1, making the real result 4. This test passes with incorrect expectations because the mock doesn't match the actual service behavior.

Copilot uses AI. Check for mistakes.
@allanhvam allanhvam merged commit 26e2cd1 into main Feb 11, 2026
1 check passed
@allanhvam allanhvam deleted the feat/typing branch February 11, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants