From 09c2ff1dae26a4603c7d61157b76b0f32f411d3b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 15 Jul 2026 19:44:12 +0300 Subject: [PATCH 1/2] Fix PrecinctOptions type --- index.d.ts | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 42226a4..4b3b892 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ export default precinct; -export type PrecinctOptions = Partial>> & { +export type PrecinctOptions = Record & { type?: string; walker?: Record; }; @@ -10,7 +10,7 @@ export type PaperworkOptions = PrecinctOptions & { }; }; /** - * @typedef {Partial>> & { + * @typedef {Record & { * type?: string, * walker?: Record * }} PrecinctOptions diff --git a/index.js b/index.js index c19285f..86c16af 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ import detectiveVue from 'detective-vue2'; const debug = debuglog('precinct'); /** - * @typedef {Partial>> & { + * @typedef {Record & { * type?: string, * walker?: Record * }} PrecinctOptions From f6da68238787a72fb8668d4e78b465a393188135 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 15 Jul 2026 20:05:48 +0300 Subject: [PATCH 2/2] Add missing precinct.ast in types --- index.d.ts | 1 + index.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/index.d.ts b/index.d.ts index 4b3b892..61e796f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -30,6 +30,7 @@ export type PaperworkOptions = PrecinctOptions & { */ declare function precinct(content: string | Record, options?: PrecinctOptions): string[]; declare namespace precinct { + let ast: Record | null; /** * Returns the dependencies for the given file path * diff --git a/index.js b/index.js index 86c16af..16f2b06 100644 --- a/index.js +++ b/index.js @@ -88,6 +88,13 @@ function precinct(content, options = {}) { return dependencies; } +/** + * The last AST produced by precinct, or null when parsing failed + * + * @type {Record | null} + */ +precinct.ast = null; + /** * Returns the dependencies for the given file path *