Skip to content

Commit 7d5f14d

Browse files
committed
Merge branch 'types' into esm
* types: fix: don't need to make the TokContext and tokTypes public; pass attw validation fix: also fix duplicate identifier problem feat: add `TokContext` as type (now that not exported as type from acorn) # Conflicts: # package.json
2 parents 2232500 + 2c18b84 commit 7d5f14d

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

index.d.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import * as acorn from 'acorn';
22

3+
declare class TokContext {
4+
constructor(
5+
token: string,
6+
isExpr: boolean,
7+
preserveSpace: boolean,
8+
override?: (parser: any) => void
9+
)
10+
}
11+
312
interface JsxTokTypes extends AcornTokTypes {
413
jsxName: acorn.TokenType,
514
jsxText: acorn.TokenType,
615
jsxTagEnd: acorn.TokenType,
716
jsxTagStart: acorn.TokenType
817
}
918

10-
declare const jsx: {
11-
tokTypes: JsxTokTypes;
12-
(options?: jsx.Options): (BaseParser: typeof acorn.Parser) => jsx.AcornJsxParserCtor
13-
}
14-
1519
type AcornTokTypes = typeof acorn.tokTypes;
1620

17-
declare namespace jsx {
21+
declare function jsx(options?: jsx.Options): (BaseParser: typeof acorn.Parser) => jsx.AcornJsxParserCtor;
1822

23+
declare namespace jsx {
1924
type TokTypes = JsxTokTypes
2025

2126
interface Options {
@@ -24,9 +29,9 @@ declare namespace jsx {
2429
}
2530

2631
interface TokContexts {
27-
tc_oTag: acorn.TokContext,
28-
tc_cTag: acorn.TokContext,
29-
tc_expr: acorn.TokContext
32+
tc_oTag: TokContext,
33+
tc_cTag: TokContext,
34+
tc_expr: TokContext
3035
}
3136

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
},
2323
"license": "MIT",
2424
"scripts": {
25+
"attw": "attw --pack",
2526
"test": "node test/run.js",
2627
"build": "rollup -c",
2728
"prepublishOnly": "npm run build"
@@ -30,7 +31,8 @@
3031
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
3132
},
3233
"devDependencies": {
33-
"acorn": "^8.0.1",
34+
"acorn": "^8.15.0",
35+
"@arethetypeswrong/cli": "^0.18.2",
3436
"rollup": "^2.12.0"
3537
}
3638
}

0 commit comments

Comments
 (0)