surrealdb / surrealdb.js

SurrealDB SDK for JavaScript
https://surrealdb.com
Apache License 2.0
294 stars 48 forks source link

fix: allow TemplateStringsArray as argument to `surrealql()` #222

Closed oliver-oloughlin closed 5 months ago

oliver-oloughlin commented 6 months ago

What is the motivation?

Currently, calling surrealql as a tagged function gives a TypeScript error complaining about the argument type of 'TemplateStringsArray` not being assignable to the parameter type of 'string[]'

What does this change do?

This change adds 'TemplateStringsArray' as a valid argument type to the surrealql function. It does not remove 'string[]' as a valid argument, and thus should not be breaking for any existing usage of the function. As surrealql does not make use of any properties specific to either 'TemplateStringsArray' or 'string[]', there should be no conflict in allowing both argument types.

What is your testing strategy?

I imported the package from the change branch in a test project and observed that the error no longer was shown when calling surrealql as a tagged function. I also checked that the function still accepted an argument of type 'string[]'.

Is this related to any issues?

Related to #221

Have you read the Contributing Guidelines?