Skip to content

Commit e9ffc1c

Browse files
committed
Clean up legacy types
1 parent 29056a7 commit e9ffc1c

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

packages/common/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export * from "./types/command/legacy/CommandV4.types";
7373
export * from "./types/command/legacy/targetDescriptorV2.types";
7474
export * from "./types/command/CommandV5.types";
7575
export * from "./types/command/legacy/PartialTargetDescriptorV3.types";
76+
export * from "./types/command/legacy/PartialTargetDescriptorV4.types";
7677
export * from "./types/CommandServerApi";
7778
export * from "./util/itertools";
7879
export * from "./extensionDependencies";

packages/common/src/types/command/legacy/PartialTargetDescriptorV4.types.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ interface PositionModifier {
253253
position: TargetPosition;
254254
}
255255

256-
interface PartialPrimitiveTargetDescriptor {
256+
export interface PartialPrimitiveTargetDescriptorV4 {
257257
type: "primitive";
258258
mark?: Mark;
259259
modifiers?: Modifier[];
@@ -326,26 +326,29 @@ type Modifier =
326326
// vertical puts a selection on each line vertically between the two targets
327327
type RangeType = "continuous" | "vertical";
328328

329-
interface PartialRangeTargetDescriptor {
329+
export interface PartialRangeTargetDescriptorV4 {
330330
type: "range";
331-
anchor: PartialPrimitiveTargetDescriptor | ImplicitTargetDescriptor;
332-
active: PartialPrimitiveTargetDescriptor;
331+
anchor: PartialPrimitiveTargetDescriptorV4 | ImplicitTargetDescriptor;
332+
active: PartialPrimitiveTargetDescriptorV4;
333333
excludeAnchor: boolean;
334334
excludeActive: boolean;
335335
rangeType?: RangeType;
336336
}
337337

338338
interface PartialListTargetDescriptor {
339339
type: "list";
340-
elements: (PartialPrimitiveTargetDescriptor | PartialRangeTargetDescriptor)[];
340+
elements: (
341+
| PartialPrimitiveTargetDescriptorV4
342+
| PartialRangeTargetDescriptorV4
343+
)[];
341344
}
342345

343346
interface ImplicitTargetDescriptor {
344347
type: "implicit";
345348
}
346349

347350
export type PartialTargetDescriptorV4 =
348-
| PartialPrimitiveTargetDescriptor
349-
| PartialRangeTargetDescriptor
351+
| PartialPrimitiveTargetDescriptorV4
352+
| PartialRangeTargetDescriptorV4
350353
| PartialListTargetDescriptor
351354
| ImplicitTargetDescriptor;

packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV3ToV4/upgradeV3ToV4.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import {
22
CommandV3,
33
CommandV4,
44
ImplicitTargetDescriptor,
5-
PartialPrimitiveTargetDescriptor,
65
PartialPrimitiveTargetDescriptorV3,
7-
PartialRangeTargetDescriptor,
8-
PartialTargetDescriptor,
6+
PartialPrimitiveTargetDescriptorV4,
7+
PartialRangeTargetDescriptorV4,
98
PartialTargetDescriptorV3,
9+
PartialTargetDescriptorV4,
1010
} from "@cursorless/common";
1111

1212
export function upgradeV3ToV4(command: CommandV3): CommandV4 {
@@ -19,7 +19,7 @@ export function upgradeV3ToV4(command: CommandV3): CommandV4 {
1919

2020
function upgradeTarget(
2121
target: PartialTargetDescriptorV3,
22-
): PartialTargetDescriptor {
22+
): PartialTargetDescriptorV4 {
2323
switch (target.type) {
2424
case "primitive":
2525
return upgradePrimitiveTarget(target);
@@ -36,8 +36,8 @@ function upgradeTarget(
3636
return {
3737
...rest,
3838
elements: elements.map(upgradeTarget) as (
39-
| PartialPrimitiveTargetDescriptor
40-
| PartialRangeTargetDescriptor
39+
| PartialPrimitiveTargetDescriptorV4
40+
| PartialRangeTargetDescriptorV4
4141
)[],
4242
};
4343
}
@@ -46,7 +46,7 @@ function upgradeTarget(
4646

4747
function upgradePrimitiveTarget(
4848
target: PartialPrimitiveTargetDescriptorV3,
49-
): PartialPrimitiveTargetDescriptor | ImplicitTargetDescriptor {
49+
): PartialPrimitiveTargetDescriptorV4 | ImplicitTargetDescriptor {
5050
if ((target.mark == null && target.modifiers == null) || target.isImplicit) {
5151
return { type: "implicit" };
5252
}

0 commit comments

Comments
 (0)