Skip to content

Commit ce0aad5

Browse files
committed
fix another type annoyance
1 parent ca20cc2 commit ce0aad5

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/languages/ts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @import { TSESTree } from '@typescript-eslint/types' */
22
/** @import { Visitors } from '../types.js' */
3-
/** @import { TSOptions } from './types.js' */
3+
/** @import { TSOptions, Comment } from './types.js' */
44
import { Context } from '../context.js';
55

66
/** @type {Record<TSESTree.Expression['type'] | 'Super' | 'RestElement', number>} */
@@ -72,7 +72,7 @@ const OPERATOR_PRECEDENCE = {
7272
};
7373

7474
/**
75-
* @param {TSESTree.Comment} comment
75+
* @param {Comment} comment
7676
* @param {Context} context
7777
*/
7878
function write_comment(comment, context) {

src/languages/types.d.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,23 @@ import type { TSESTree } from '@typescript-eslint/types';
22

33
export type TSOptions = {
44
quotes?: 'double' | 'single';
5-
comments?: TSESTree.Comment[];
5+
comments?: Comment[];
66
};
7+
8+
interface Position {
9+
line: number;
10+
column: number;
11+
}
12+
13+
// this exists in TSESTree but because of the inanity around enums
14+
// it's easier to do this ourselves
15+
export interface Comment {
16+
type: 'Line' | 'Block';
17+
value: string;
18+
start?: number;
19+
end?: number;
20+
loc: {
21+
start: Position;
22+
end: Position;
23+
};
24+
}

0 commit comments

Comments
 (0)