Skip to content

Bug: Typescript complains when connecting record user via connect() method #616

Description

@ntorrey

Describe the bug

In the SDK v2.0.3, connecting as a record user via the connect() method works, but the typescript compiler complains:

await db
    .connect(url, {
      namespace: 'test',
      database: 'test',
      access: 'anyuser',
      variables: {
         test: 'test'
      },
      reconnect: true,
      versionCheck: false
})

But the type definition defined here doesn't seem to account for this method of connecting when using the connect() method. Should it not rather be the following?

export type ProvidedAuth = AnyAuth | null;

Steps to reproduce

Try the code written above. The typescript compiler will complain that 'access' does not exist in type RootAuth | NamespaceAuth | DatabaseAuth | AuthCallable.

Expected behaviour

I would like to connect as a record user using the connect() method without typescript complaining.

SurrealDB version

Not relevant in this case, but I'm trying to upgrade to surrealdb version 3.1.2.

JavaScript SDK version

2.0.3

Contact Details

this issue

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct (repository /surrealdb.js)

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions