From acf7d48583aaae25a699debbff1092d1194a1679 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 27 Oct 2025 01:26:47 -0700 Subject: [PATCH] feat: add `TokContext` as type (now that not exported as type from acorn) Also: - fix: pass attw validation --- index.d.ts | 15 ++++++++++++--- package.json | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 66ef62f..12ecfce 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,14 @@ import * as acorn from 'acorn'; +declare class TokContext { + constructor( + token: string, + isExpr: boolean, + preserveSpace: boolean, + override?: (parser: any) => void + ) +} + interface JsxTokTypes extends AcornTokTypes { jsxName: acorn.TokenType, jsxText: acorn.TokenType, @@ -24,9 +33,9 @@ declare namespace jsx { } interface TokContexts { - tc_oTag: acorn.TokContext, - tc_cTag: acorn.TokContext, - tc_expr: acorn.TokContext + tc_oTag: TokContext, + tc_cTag: TokContext, + tc_expr: TokContext } // We pick (statics) from acorn rather than plain extending to avoid complaint diff --git a/package.json b/package.json index 6debde9..8e21fe0 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,14 @@ }, "license": "MIT", "scripts": { + "attw": "attw --pack", "test": "node test/run.js" }, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "devDependencies": { - "acorn": "^8.0.1" + "@arethetypeswrong/cli": "^0.18.2", + "acorn": "^8.15.0" } }