Skip to content

Commit 858cc25

Browse files
committed
feat: add TokContext as type (now that not exported as type from acorn)
1 parent 8ed96d6 commit 858cc25

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

index.d.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ declare namespace jsx {
2323
allowNamespaces?: boolean;
2424
}
2525

26+
// As per https://github.com/acornjs/acorn/issues/1404 ,
27+
// acorn is not exporting all of its interface for plugin
28+
// authors, so we add this class here ourselves
29+
class TokContext {
30+
constructor(
31+
token: string,
32+
isExpr: boolean,
33+
preserveSpace: boolean,
34+
override?: (parser: any) => void
35+
)
36+
}
37+
2638
interface TokContexts {
27-
tc_oTag: acorn.TokContext,
28-
tc_cTag: acorn.TokContext,
29-
tc_expr: acorn.TokContext
39+
tc_oTag: TokContext,
40+
tc_cTag: TokContext,
41+
tc_expr: TokContext
3042
}
3143

3244
// We pick (statics) from acorn rather than plain extending to avoid complaint

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
2323
},
2424
"devDependencies": {
25-
"acorn": "^8.0.1"
25+
"acorn": "^8.15.0"
2626
}
2727
}

0 commit comments

Comments
 (0)