Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSC: test-project-rsa: Fix TS type error in onSend #9332

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(' ')] }
}

Loading