marcoeg
marcoeg
WWasp
Created by marcoeg on 2/2/2025 in #đŸ™‹questions
signup() not accepting custom fields in Typescript
I am having hard time to successfully write a custom signup page in Typescript. I followed the details on the Customizing the Signup Process and the Defining Extra Fields documents. I have defined my own custom component for the signup form, defined the userSignupFields object, all as described. However, unlike the example provided when I try to call the signup() function with any additional fields other than email and password, for instance firstName, I get the error:
[ Wasp ] ext-src/auth/SignupPage.tsx(83,9): error TS2353: Object literal may only specify known properties, and 'firstName' does not exist in type '{ email: string; password: string; }'.
[ Wasp ] ext-src/auth/SignupPage.tsx(83,9): error TS2353: Object literal may only specify known properties, and 'firstName' does not exist in type '{ email: string; password: string; }'.
If I bypass type checking, I don't get the error but the additional field is not stored in the database:
const onSubmit = async (data: any) => {
try {
await signup({
email: data.email,
password: data.password,
firstName: data.firstName,
} as any )
...
const onSubmit = async (data: any) => {
try {
await signup({
email: data.email,
password: data.password,
firstName: data.firstName,
} as any )
...
Please advise.
11 replies