Skip to content

Commit

Permalink
refactor(egf): update type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 19, 2024
1 parent f3e8c7a commit 38c729d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/egf/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn3, IDeref, IEquiv, IObjectOf } from "@thi.ng/api";
import type { Fn3, IDeref, IEquiv, IObjectOf, Maybe } from "@thi.ng/api";
import { isNode } from "@thi.ng/checks/is-node";
import { unsupported } from "@thi.ng/errors/unsupported";
import type { ILogger } from "@thi.ng/logger";
Expand All @@ -8,7 +8,7 @@ export interface Node {
[id: string]: any;
}

export interface NodeRef extends IDeref<Node | undefined>, IEquiv {
export interface NodeRef extends IDeref<Maybe<Node>>, IEquiv {
$ref: string;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/egf/src/convert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn, Fn2 } from "@thi.ng/api";
import type { Fn, Fn2, Maybe } from "@thi.ng/api";
import { isArray } from "@thi.ng/checks/is-array";
import { isDate } from "@thi.ng/checks/is-date";
import { isNumber } from "@thi.ng/checks/is-number";
Expand Down Expand Up @@ -29,7 +29,7 @@ export const toEGF = (

export const toEGFNode = (
node: Node,
prefix: Fn<string, string | undefined>,
prefix: Fn<string, Maybe<string>>,
propFn: Fn2<string, any, string> = toEGFProp
) => {
if (isToEGF(node)) return node.toEGF();
Expand Down
4 changes: 2 additions & 2 deletions packages/egf/src/parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IObjectOf } from "@thi.ng/api";
import type { IObjectOf, Maybe } from "@thi.ng/api";
import { illegalState } from "@thi.ng/errors/illegal-state";
import { unsupported } from "@thi.ng/errors/unsupported";
import { NULL_LOGGER } from "@thi.ng/logger/null";
Expand Down Expand Up @@ -105,7 +105,7 @@ const parseProp = (
let idx = line.indexOf(" ", idx0);
let key = unescape(line.substring(idx0, idx));
ctx.opts.prefixes && (key = qualifiedID(ctx.prefixes, key));
let tag: string | undefined;
let tag: Maybe<string>;
let body: string;
idx++;
if (line[idx] === "-" && line[idx + 1] === ">") {
Expand Down

0 comments on commit 38c729d

Please sign in to comment.