snowflakedb / snowflake-connector-nodejs

NodeJS driver
Apache License 2.0
118 stars 123 forks source link

SNOW-1508219: In type of StatementOption, `complete` should be optional #860

Open etienne-collibra opened 3 weeks ago

etienne-collibra commented 3 weeks ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch snowflake-sdk@1.11.0 for the project I'm working on.

After upgrading to 1.11.0 I got a type error cause by a missing complete callback. This callback was optional in @types/snowflake-sdk (link). Looking at the code the callback seems indeed optional.

Here is the diff that solved my problem:

diff --git a/node_modules/snowflake-sdk/index.d.ts b/node_modules/snowflake-sdk/index.d.ts
index 7d494f7..3d5ce77 100644
--- a/node_modules/snowflake-sdk/index.d.ts
+++ b/node_modules/snowflake-sdk/index.d.ts
@@ -491,7 +491,7 @@ declare module 'snowflake-sdk' {

     export interface StatementOption {
         sqlText: string;
-        complete: StatementCallback;
+        complete?: StatementCallback;

         /**
          * The requestId is for resubmitting requests.

This issue body was partially generated by patch-package.

sfc-gh-dszmolka commented 3 weeks ago

hi - thank you for the detailed error description! indeed looks to be optional and apparently wasn't addressed in https://github.com/snowflakedb/snowflake-connector-nodejs/pull/851 either. we'll look.

sfc-gh-dszmolka commented 3 weeks ago

https://github.com/snowflakedb/snowflake-connector-nodejs/pull/861

sfc-gh-dszmolka commented 3 weeks ago

fix is now merged and will be part of the next release. Thank you again for your contribution!