From 7b72f2097dca3fe6c84fe1de58d3065883883bc0 Mon Sep 17 00:00:00 2001 From: Jim Gerth Date: Mon, 18 Nov 2024 15:47:55 +0100 Subject: [PATCH] fix(ferry): Cast ErrorTypedLink's forward response stream to TData/TVars In the ErrorTypedLink, the response stream recieved via the forward function is not type-constrained, thus cast it to be of the generic types TData and TVars. Signed-off-by: Jim Gerth --- packages/ferry/lib/src/error_typed_link.dart | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/ferry/lib/src/error_typed_link.dart b/packages/ferry/lib/src/error_typed_link.dart index 459bab98..9a1f199b 100644 --- a/packages/ferry/lib/src/error_typed_link.dart +++ b/packages/ferry/lib/src/error_typed_link.dart @@ -22,19 +22,21 @@ class ErrorTypedLink extends TypedLink { forward, ]) { try { - return forward!(operationRequest).transform( - StreamTransformer.fromHandlers( - handleError: (error, stackTrace, sink) => sink.add( - OperationResponse( - operationRequest: operationRequest, - linkException: error is LinkException - ? error - : TypedLinkException(error, stackTrace), - dataSource: DataSource.None, + return forward!(operationRequest) + .cast>() + .transform( + StreamTransformer.fromHandlers( + handleError: (error, stackTrace, sink) => sink.add( + OperationResponse( + operationRequest: operationRequest, + linkException: error is LinkException + ? error + : TypedLinkException(error, stackTrace), + dataSource: DataSource.None, + ), + ), ), - ), - ), - ); + ); } catch (error, stackTrace) { return Stream.value( OperationResponse(