Skip to content

Commit ca20cc2

Browse files
committed
fix some type stuff
1 parent 9e57d7c commit ca20cc2

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ let btoa = () => {
99

1010
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
1111
btoa = (str) => window.btoa(unescape(encodeURIComponent(str)));
12-
// @ts-expect-error
1312
} else if (typeof Buffer === 'function') {
14-
// @ts-expect-error
1513
btoa = (str) => Buffer.from(str, 'utf-8').toString('base64');
1614
}
1715

@@ -48,7 +46,7 @@ class SourceMap {
4846

4947
/**
5048
* @template {BaseNode} [T=BaseNode]
51-
* @param {{ type: string, [key: string]: any }} node
49+
* @param {T} node
5250
* @param {Visitors<T>} visitors
5351
* @param {PrintOptions} opts
5452
* @returns {{ code: string, map: any }} // TODO

src/languages/ts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,10 +1524,11 @@ export default (options = {}) => {
15241524

15251525
context.write('(');
15261526

1527-
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
15281527
sequence(
15291528
context,
1529+
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
15301530
node.parameters,
1531+
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
15311532
node.typeAnnotation.typeAnnotation.loc?.start ?? null,
15321533
false
15331534
);

test/common.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { tsPlugin } from '@sveltejs/acorn-typescript';
55

66
/** @import { TSESTree } from '@typescript-eslint/types' */
77

8-
// @ts-expect-error
9-
export const acornTs = acorn.Parser.extend(tsPlugin({ allowSatisfies: true }));
10-
export const acornTsx = acorn.Parser.extend(tsPlugin({ allowSatisfies: true, jsx: true }));
8+
export const acornTs = acorn.Parser.extend(tsPlugin());
9+
export const acornTsx = acorn.Parser.extend(tsPlugin({ jsx: true }));
1110

1211
/** @param {string} input
1312
* @param {{ jsx?: boolean }} opts

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"target": "esnext",
88
"module": "esnext",
99
"moduleResolution": "bundler",
10-
"lib": ["esnext", "dom"]
10+
"lib": ["esnext", "dom"],
11+
"skipLibCheck": true
1112
},
12-
"include": ["./src/**/*.js"]
13+
"include": ["./src/**/*.js", "./test/*.js"]
1314
}

0 commit comments

Comments
 (0)