snowflake-connector-nodejs icon indicating copy to clipboard operation
snowflake-connector-nodejs copied to clipboard

SNOW-595248: Port the library to TypeScript

Open varun-dc opened this issue 3 years ago • 4 comments

This library is written in a old style JavaScript manner. While this is functional for the most part, it would be more maintainable if it was written in a well typed language like TypeScript that would allow better type checking, preventing bugs like https://github.com/snowflakedb/snowflake-connector-nodejs/issues/308 (which occurred because of a type mismatch related error)

The library would also be easier for outside contributors to understand as well if they could lean on the TypeScript compiler and associated tooling to navigate and understand the code.

varun-dc avatar May 25 '22 22:05 varun-dc

I completely agree. I was trying to make sense of this library to add functionality of uploading a file from a stream instead of the hard-coded file path upload that is supported. But I gave up because the library was too much a mess.

kri5t avatar Oct 28 '22 12:10 kri5t

We plan to add the support for Typescript support, and it's in our backlog. I dont have any ETA yet, but we will prioritize it as we do the next quarter planning. We will keep this thread updated.

Thanks all for your patience.

sfc-gh-anugupta avatar Jul 17 '23 17:07 sfc-gh-anugupta

In case this helps increase the priority of this change, the corresponding type dependency for this library, https://www.npmjs.com/package/@types/snowflake-sdk is quite out of date. For example, there are no typings for parameters, which is important for allowing multi-statement SQL batches on specific queries.

(I understand that typing library is not maintained by Snowflake, but porting the library to TS would remove the need for that dependency entirely and would automatically keep the types and source code in sync)

dylangrandmont avatar Nov 20 '23 19:11 dylangrandmont

Hi everyone - it's been a while but I have some progress to report. We're actively working on adding the typing for snowflake-sdk and then going forward, maintaining it which will allow us to release the changes to the typing alongside with the changes of the driver, if any. Thus hopefully preventing the discrepancy between the changes to the driver library vs. the externally maintained typing lagging behind.

Rewriting the whole library in TypeScript is another story though, I don't have any estimation for that, but the types are coming soon. edit: PR is https://github.com/snowflakedb/snowflake-connector-nodejs/pull/762 - will keep this thread posted with the progress

sfc-gh-dszmolka avatar Feb 08 '24 08:02 sfc-gh-dszmolka

PR https://github.com/snowflakedb/snowflake-connector-nodejs/pull/762 has been merged now, and will be released with the next release cycle, towards end of May 2024

sfc-gh-dszmolka avatar May 22 '24 08:05 sfc-gh-dszmolka

released with May 2024 release cycle, version 1.11.0. thank you for your patience here !

Note: if the externally maintained typings might be conflicting now with the Snowflake-internal ones, please try to uninstall the external one / remove it from the dependencies. Also if there are unexpected issues with the typings, do raise a new issue please.

For rewriting and porting the whole library to TypeScript, there is no plans for the foreseeable future.

sfc-gh-dszmolka avatar May 29 '24 04:05 sfc-gh-dszmolka