Skip to content

Commit 08e63e5

Browse files
committed
Fix a few code smells
1 parent 478a4f5 commit 08e63e5

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"jest-extended": "^6.0.0",
5959
"prettier": "^3.4.1",
6060
"ts-jest": "^29.2.5",
61-
"typedoc": "^0.28.5",
61+
"typedoc": "^0.28.7",
6262
"typescript": "^5.6.3"
6363
}
6464
}

src/clauses/sub-clauses/Delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class DeleteClause extends CypherASTNode {
3232
private readonly deleteInput: DeleteInput;
3333
private detachKeyword: DetachKeyword | undefined;
3434

35-
constructor(parent: CypherASTNode | undefined, deleteInput: DeleteInput) {
35+
constructor(parent: CypherASTNode, deleteInput: DeleteInput) {
3636
super(parent);
3737
this.deleteInput = deleteInput;
3838
}

src/clauses/sub-clauses/ImportWith.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import type { CypherEnvironment } from "../../Environment";
2222
import type { Param } from "../../references/Param";
2323
import type { PropertyRef } from "../../references/PropertyRef";
2424
import type { Variable } from "../../references/Variable";
25-
import type { Call } from "../Call";
2625

2726
export type SetParam = [PropertyRef, Param<unknown>];
2827

@@ -31,7 +30,7 @@ export class ImportWith extends CypherASTNode {
3130
private readonly params: Variable[];
3231
private hasStar = false;
3332

34-
constructor(parent: Call, params: Array<"*" | Variable>) {
33+
constructor(parent: CypherASTNode, params: Array<"*" | Variable>) {
3534
super(parent);
3635
this.params = this.filterParams(params);
3736
}

src/expressions/functions/string.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,16 @@ export function toUpper(original: Expr): CypherFunction {
163163
return new CypherFunction("toUpper", [original]);
164164
}
165165

166+
/** @inline */
167+
type TrimOption = "BOTH" | "LEADING" | "TRAILING";
168+
166169
/** Implements a trim function with a trim expression `trim(BOTH 'x' FROM 'xxxhelloxxx')` */
167170
class TrimFunction extends CypherFunction {
168-
private readonly typeOrInput: "BOTH" | "LEADING" | "TRAILING";
171+
private readonly typeOrInput: TrimOption;
169172
private readonly trimChar: Expr;
170173
private readonly input: Expr;
171174

172-
constructor(typeOrInput: "BOTH" | "LEADING" | "TRAILING", trimChar: Expr, input: Expr) {
175+
constructor(typeOrInput: TrimOption, trimChar: Expr, input: Expr) {
173176
super("trim");
174177
this.typeOrInput = typeOrInput;
175178
this.trimChar = trimChar;
@@ -189,13 +192,9 @@ class TrimFunction extends CypherFunction {
189192
* @group Functions
190193
* @category String
191194
*/
192-
export function trim(type: "BOTH" | "LEADING" | "TRAILING", trimChar: Expr, input: Expr): CypherFunction;
195+
export function trim(type: TrimOption, trimChar: Expr, input: Expr): CypherFunction;
193196
export function trim(input: Expr): CypherFunction;
194-
export function trim(
195-
typeOrInput: "BOTH" | "LEADING" | "TRAILING" | Expr,
196-
trimChar?: Expr,
197-
input?: Expr
198-
): CypherFunction {
197+
export function trim(typeOrInput: TrimOption | Expr, trimChar?: Expr, input?: Expr): CypherFunction {
199198
if (typeof typeOrInput === "string") {
200199
if (!trimChar || !input) {
201200
throw new Error("Invalid parameters in trim. trimChar and input must be valid Expr");

0 commit comments

Comments
 (0)