Skip to content

Commit

Permalink
fix(ai/rsc): Improve streamable .done() types (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Mar 11, 2024
1 parent fce8b10 commit 81ca3d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-pants-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ai': patch
---

fix(ai/rsc): improve .done() argument type
3 changes: 3 additions & 0 deletions packages/core/rsc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ export type {
render,
createAI,
} from './rsc-server';

export type {
readStreamableValue,
useUIState,
useAIState,
useActions,
useSyncUIState,
} from './rsc-client';

export type { StreamableValue } from './types';
4 changes: 2 additions & 2 deletions packages/core/rsc/streamable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function createStreamableUI(initialValue?: React.ReactNode) {
closed = true;
reject(error);
},
done(...args: any) {
done(...args: [] | [React.ReactNode]) {
assertStream('.done()');

if (warningTimeout) {
Expand Down Expand Up @@ -187,7 +187,7 @@ export function createStreamableValue<T = any, E = any>(initialValue?: T) {

resolvable.resolve({ error });
},
done(...args: any) {
done(...args: [] | [T]) {
assertStream('.done()');

if (warningTimeout) {
Expand Down

0 comments on commit 81ca3d6

Please sign in to comment.