CouchDB has update_seq field in response for changes API to identify the state of database. However, the actual response in couchdb contains string data in the field. For example, if we try to get db info for db foo from couchdb (localhost:5984/foo), we get response similar to below:
The following interfaces should have update_seq and purge_seq defined as string type:
DatabaseGetResponse
DocumentListResponse
DocumentFetchResponse
DocumentFetchRevsResponse
Current Behavior
The provided interfaces have the update_seq and purge_seq defined as integer which does not match with the datatype in actual response object. It is not causing any issues at runtime due to typeless behaviour of Javascript but it certainly is a issue when writing our projects as the datatype is ambiguous due to mismatch.
Possible Solution
Change the datatype for the update_seq and purge_seq in nano.d.ts from number to string but it will be a breaking change. Instead we can change it to number | string to preserve backwards compatibility.
Also, I believe, earlier the response contained actual integers but later it changed to string, so if define the datatype to be number | string instead of number that it is currently, it won't be a breaking change and will also conform to older versions of couchdb.
CouchDB has
update_seq
field in response for changes API to identify the state of database. However, the actual response in couchdb contains string data in the field. For example, if we try to get db info for dbfoo
from couchdb (localhost:5984/foo
), we get response similar to below:Expected Behavior
The following interfaces should have update_seq and purge_seq defined as string type:
Current Behavior
The provided interfaces have the
update_seq
andpurge_seq
defined as integer which does not match with the datatype in actual response object. It is not causing any issues at runtime due to typeless behaviour of Javascript but it certainly is a issue when writing our projects as the datatype is ambiguous due to mismatch.Possible Solution
Change the datatype for the
update_seq
andpurge_seq
in nano.d.ts fromnumber
tostring
but it will be a breaking change. Instead we can change it tonumber | string
to preserve backwards compatibility. Also, I believe, earlier the response contained actual integers but later it changed to string, so if define the datatype to benumber | string
instead ofnumber
that it is currently, it won't be a breaking change and will also conform to older versions of couchdb.I have also raised a PR for the same.
Your Environment