Skip to content

Commit 43c6944

Browse files
Eliminate CursorOptions type; treat cursorOffset just like any other option
1 parent 7ffecef commit 43c6944

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/index.d.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ export interface RequiredOptions extends doc.printer.Options {
353353
* @deprecated use bracketSameLine instead
354354
*/
355355
jsxBracketSameLine: boolean;
356+
/**
357+
* Specify where the cursor is.
358+
* @default -1
359+
*/
360+
cursorOffset: number;
356361
/**
357362
* Format only a segment of a file.
358363
* @default 0
@@ -543,13 +548,6 @@ export interface Printer<T = any> {
543548
| undefined;
544549
}
545550

546-
export interface CursorOptions extends Options {
547-
/**
548-
* Specify where the cursor is.
549-
*/
550-
cursorOffset: number;
551-
}
552-
553551
export interface CursorResult {
554552
formatted: string;
555553
cursorOffset: number;
@@ -574,7 +572,7 @@ export function check(source: string, options?: Options): Promise<boolean>;
574572
*/
575573
export function formatWithCursor(
576574
source: string,
577-
options: CursorOptions,
575+
options: Options,
578576
): Promise<CursorResult>;
579577

580578
export interface ResolveConfigOptions {

src/standalone.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
1+
import { CursorResult, Options, SupportInfo } from "./index.js";
22

33
/**
44
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
@@ -13,7 +13,7 @@ import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
1313
*/
1414
export function formatWithCursor(
1515
source: string,
16-
options: CursorOptions,
16+
options: Options,
1717
): Promise<CursorResult>;
1818

1919
/**

0 commit comments

Comments
 (0)