Skip to content

Commit 45065da

Browse files
authored
RSC: test-project-rsa: Fix TS type error in onSend (#9332)
1 parent 4c5a3eb commit 45065da

File tree

1 file changed

+9
-2
lines changed
  • __fixtures__/test-project-rsa/web/src

1 file changed

+9
-2
lines changed

__fixtures__/test-project-rsa/web/src/chat.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import { randomWords } from './words'
44

55
export async function onSend(formData: FormData) {
6-
console.log('message', formData.get('message'))
6+
const message = formData.get('message')
7+
8+
console.log('message', message)
9+
10+
if (typeof message !== 'string') {
11+
throw new Error('message must be a string')
12+
}
713

814
// Locally you could do this:
915
// const words = await fetch(
@@ -12,5 +18,6 @@ export async function onSend(formData: FormData) {
1218
// But in CI we don't want to hit an external API, so we just do this instead:
1319
const words = await randomWords(5)
1420

15-
return { messages: [formData.get('message'), words.join(' ')] }
21+
return { messages: [message, words.join(' ')] }
1622
}
23+

0 commit comments

Comments
 (0)