Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-842

Provide Proper Type Definitions

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.2.0-alpha.2
    • None
    • library
    • None
    • 1

    Description

      I don't want to come across as ungrateful for the work that has been done to incorporate TypeScript users, but the current situation is unusable and confusing, especially when following the documentation for the SDK causes a loss of type safety. 

      For example, due to the use of the @hidecontructor tag on the Cluster class, I cannot directly instantiate a cluster like in the example while being type safe (it has type any). If I use ESModule syntax, I can...

      import 'couchbase'
      

      ... which gets type safety, but now I only have direct access to a connect function and the libcversion.

      Unfortunately, the connect function returns a promise so unless I want to go through the frustration of setting up node.js to allow for top level await, there is no straight forward way to get a cluster to begin work.

      Additionally, in order to get types in any file using couchbase I have to import the entire thing as opposed to something like

      import { MutateInSpec } from 'couchbase'

      All to say the current setup runs counterintuitive to standard ways of using a library in TypeScript.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              brett19 Brett Lawson
              kralphs Kevin Ralphs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty