Skip to content

Commit

Permalink
RSC: test-project-rsa: Fix TS type error in onSend (#9332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Oct 25, 2023
1 parent 4c5a3eb commit 45065da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions __fixtures__/test-project-rsa/web/src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import { randomWords } from './words'

export async function onSend(formData: FormData) {
console.log('message', formData.get('message'))
const message = formData.get('message')

console.log('message', message)

if (typeof message !== 'string') {
throw new Error('message must be a string')
}

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

return { messages: [formData.get('message'), words.join(' ')] }
return { messages: [message, words.join(' ')] }
}

0 comments on commit 45065da

Please sign in to comment.