Is this an issue or am I doing something wrong?

I want to save a username custom field when I sign a member up. In my backend code, I have

authentication.register(email, password, {
	username: username
}}

But it underlines the username:username in red (I do have a username variable) and gives me this when I hover over it:

Type ‘{ username: any; }’ is not assignable to type ‘ContactInfo’. Object literal may only specify known properties, and ‘username’ does not exist in type ‘ContactInfo’. It’s recommended you use a new variable, such as “let newVar = …” to make sure that all code completion work correctly.

Why is this happening? I have a username custom field in my contacts list. Thanks in advance!

The options parameter of the register API function needs to be a ContactInfo object, which contains an object for customFields. An example would be something like this:

{
   contactInfo: {
      firstName: 'Javier',
      lastName: 'Doe',
      customFields: {
         username: username,
      }
   },
}

The above was untested so I would suggest you refer to the documentation for the details and code snippet examples.