Skip to content

Commit eaa7173

Browse files
authored
chore: use erasableSyntaxOnly (#684)
1 parent 12fd20c commit eaa7173

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

src/llhttp/http.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import assert from 'assert';
22
import { type LLParse, source } from 'llparse';
33

4-
import Match = source.node.Match;
5-
import Node = source.node.Node;
4+
const { Node } = source.node;
5+
6+
type Match = source.node.Match;
7+
type Node = source.node.Node;
68

79
import {
810
type CharList,
@@ -171,8 +173,11 @@ export class HTTP {
171173
private readonly span: ISpanMap;
172174
private readonly callback: ICallbackMap;
173175
private readonly nodes = new Map<string, Match>();
176+
private readonly llparse: LLParse;
177+
178+
constructor(llparse: LLParse) {
179+
this.llparse = llparse;
174180

175-
constructor(private readonly llparse: LLParse) {
176181
const p = llparse;
177182

178183
this.url = new URL(p);

src/llhttp/url.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { type LLParse, source } from 'llparse';
1+
import { type LLParse, type source } from 'llparse';
22

3-
import Match = source.node.Match;
4-
import Node = source.node.Node;
3+
type Node = source.node.Node;
4+
type Match = source.node.Match;
55

66
import {
77
ALPHA,
@@ -30,8 +30,10 @@ export class URL {
3030
private readonly spanTable: SpanTable = new Map();
3131
private readonly errorInvalid: Node;
3232
private readonly URL_CHAR: CharList;
33+
private readonly llparse: LLParse;
3334

34-
constructor(private readonly llparse: LLParse, separateSpans = false) {
35+
constructor(llparse: LLParse, separateSpans = false) {
36+
this.llparse = llparse;
3537
const p = this.llparse;
3638

3739
this.errorInvalid = p.error(ERROR.INVALID_URL, 'Invalid characters in url');

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"declaration": true,
1212
"pretty": true,
1313
"sourceMap": true,
14+
"erasableSyntaxOnly": true
1415
},
1516
"include": ["src/**/*.ts"],
1617
}

tsconfig.test.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true
6+
},
37
"include": ["bench/**/*.ts", "bin/**/*.ts", "src/**/*.ts", "test/**/*.ts", "eslint.config.mjs"],
48
}

0 commit comments

Comments
 (0)