Skip to content

Commit

Permalink
Accept undefined in setLastTxnTs input but treat it as a no-op. This …
Browse files Browse the repository at this point in the history
…resolves typescript compilation errors while maintaining current behavior
  • Loading branch information
cleve-fauna committed Aug 29, 2023
1 parent 3a0904f commit d0cc95e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fauna",
"version": "1.0.1",
"version": "1.0.2",
"description": "A driver to query Fauna databases in browsers, Node.js, and other Javascript runtimes",
"homepage": "https://fauna.com",
"bugs": {
Expand Down
13 changes: 6 additions & 7 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,19 @@ export class Client {
/**
* @returns the last transaction time seen by this client, or undefined if this client has not seen a transaction time.
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore it's okay that #lastTxnTs could be undefined on get, but we want
// to enforce that the user never intentionally set it to undefined.
get lastTxnTs(): number | undefined {
return this.#lastTxnTs;
}
/**
* Sets the last transaction time of this client.
* @param ts - the last transaction timestamp to set, as microseconds since
* the epoch. If `ts` is less than the existing `#lastTxnTs` value, then no
* change is made.
* the epoch. If `ts` is less than the existing `#lastTxnTs` value or is
* undefined , then no change is made.
*/
set lastTxnTs(ts: number) {
this.#lastTxnTs = this.#lastTxnTs ? Math.max(ts, this.#lastTxnTs) : ts;
set lastTxnTs(ts: number | undefined) {
if (ts !== undefined) {
this.#lastTxnTs = this.#lastTxnTs ? Math.max(ts, this.#lastTxnTs) : ts;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/util/package-version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//THIS FILE IS AUTOGENERATED. DO NOT EDIT. SEE .husky/pre-commit

/** The current package version. */
export const packageVersion = "1.0.1";
export const packageVersion = "1.0.2";

0 comments on commit d0cc95e

Please sign in to comment.