surrealdb / surrealdb.deno

A Deno engine for the SurrealDB JavaScript SDK
https://surrealdb.com
Apache License 2.0
12 stars 4 forks source link

Constructor interface. #3

Closed reedHam closed 2 years ago

reedHam commented 2 years ago

The current deno class interface requires a token.

https://github.com/surrealdb/surrealdb.deno/blob/675705de6aa0130449b19f1c3c2f8491bcc2188f/src/mod.ts#L70

const DB = new Surreal("https://localhost:8000/rpc"); // <<- type error token required.

I have to add an empty string to get it to compile.

const DB = new Surreal("https://localhost:8000/rpc", "");

This does not match the documents on https://surrealdb.com/docs/integration/libraries/deno

W4G1 commented 2 years ago

This is a typescript issue and since there are no types, we have to wait until they are added.

In the meantime you can also do this:

const DB = new Surreal("https://localhost:8000/rpc", undefined);