




















@@ -147,6 +147,7 @@ export function resolveOcPath(ast: OcAst, path: OcPath): OcMatch | null {
147147case "jsonl":
148148return resolveJsonlToUniversal(ast, path);
149149}
150+return null;
150151}
151152152153function resolveMdToUniversal(ast: MdAst, path: OcPath): OcMatch | null {
@@ -164,6 +165,7 @@ function resolveMdToUniversal(ast: MdAst, path: OcPath): OcMatch | null {
164165case "item-field":
165166return { kind: "leaf", valueText: m.value, leafType: "string", line: m.node.line };
166167}
168+return null;
167169}
168170169171function resolveJsoncToUniversal(ast: JsoncAst, path: OcPath): OcMatch | null {
@@ -189,6 +191,7 @@ function jsoncValueToMatch(value: JsoncValue, line: number): OcMatch {
189191case "null":
190192return { kind: "leaf", valueText: "null", leafType: "null", line };
191193}
194+return { kind: "leaf", valueText: "null", leafType: "null", line };
192195}
193196194197function resolveJsonlToUniversal(ast: JsonlAst, path: OcPath): OcMatch | null {
@@ -211,6 +214,7 @@ function resolveInsertion(ast: OcAst, info: InsertionInfo): OcMatch | null {
211214case "jsonl":
212215return resolveJsonlInsertion(ast, info);
213216}
217+return null;
214218}
215219216220function resolveMdInsertion(ast: MdAst, info: InsertionInfo): OcMatch | null {
@@ -304,15 +308,16 @@ export function setOcPath(ast: OcAst, path: OcPath, value: string): SetResult {
304308return r.ok ? { ok: true, ast: r.ast } : { ok: false, reason: r.reason };
305309});
306310}
311+return { ok: false, reason: "not-writable" };
307312}
308313309314// Resolve → reject root/line → coerce by existing leaf type → set →
310315// wrap. The optional `onLine` handles jsonl's whole-line replacement.
311-function setStructuredLeaf<A extends OcAst, M extends StructuredLeafMatch>(
316+function setStructuredLeaf<A extends OcAst>(
312317ast: A,
313318path: OcPath,
314319value: string,
315-resolve: (a: A, p: OcPath) => M | null,
320+resolve: (a: A, p: OcPath) => StructuredLeafMatch | null,
316321set: (a: A, p: OcPath, c: JsoncValue) => SetOpResult<A>,
317322onLine?: () => SetResult,
318323): SetResult {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。