Fix generated workflow typing for composite declaration emit#28
Merged
Conversation
- Add DeclaredAgent<Ops> named type to @tisyn/agent so agent() return type survives declaration emit without referencing internal paths - Add TisynFn<A, R> to Call() first parameter so TisynFn values can be passed directly without as-never casts - Add IrInput = TisynExpr | Expr<any> to @tisyn/ir covering all typed and untyped IR roots - Widen execute() ir type to IrInput, capturing validated IR from assertValidIr() for downstream use - Compiler codegen now emits TisynFn annotations on workflow exports and DeclaredAgent return types on factory functions - Extend ParsedFunction with paramTypes/returnType extracted from source AST - Update semantic type-check test stubs to include DeclaredAgent, OperationSpec, TisynFn
Replace Expr<any> (which collapses to any) with explicit TypedIrNode union. Add expectTypeOf positive/negative tests for IrInput, declaration- emit regression test for TS2742, and Call(workflow) consumer typing test.
The test was only calling program.getSemanticDiagnostics() which can't catch TS2742 (an emit-time naming failure). Now runs program.emit() when declaration options are set and combines emit diagnostics with semantic diagnostics.
taras
added a commit
that referenced
this pull request
Mar 24, 2026
- Replace Call(chat as never) with Call(chat) in all 4 files now that Call() accepts TisynFn<A, R> directly - Add extractMessage() runtime narrowing helper in phase4-e2e test instead of raw cast on protocol args payload
taras
added a commit
that referenced
this pull request
Mar 24, 2026
- Replace Call(chat as never) with Call(chat) in all 4 files now that Call() accepts TisynFn<A, R> directly - Add extractMessage() runtime narrowing helper in phase4-e2e test instead of raw cast on protocol args payload
taras
added a commit
that referenced
this pull request
Mar 27, 2026
- Replace Call(chat as never) with Call(chat) in all 4 files now that Call() accepts TisynFn<A, R> directly - Add extractMessage() runtime narrowing helper in phase4-e2e test instead of raw cast on protocol args payload
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
@tisyn/agent: ExportDeclaredAgent<Ops>named type alias soagent()return type survives declaration emit without TS2742 (referencing internaldist/types.jspaths)@tisyn/ir: AddTisynFn<A, R>toCall()first parameter soCall(chat)works whenchat: TisynFn<[], void>— noas nevercast needed. AddIrInput = TisynExpr | Expr<any>covering all typed and untyped IR roots@tisyn/runtime: WidenExecuteOptions.irtoIrInputso phantom-typed constructor results (Call(),Q(),Fn()) are accepted without casts@tisyn/compiler: Codegen now emitsTisynFn<[paramTypes], returnType>annotations on workflow exports andDeclaredAgent<{...}>return types on factory functions.ParsedFunctionextended to capture param/return types from source ASTTest plan
pnpm build— all packages build cleanpnpm test— all 788 tests pass across 10 packagesworkflow.generated.tsand verifyCall(chat)withoutas nevercomposite: true/declaration: true