Skip to content

Commit

Permalink
Fixed correct TS types (#2741)
Browse files Browse the repository at this point in the history
* Fixed cottect TS types

Now is correct extension from windows,
Now windows accetp T generic arguments, first accept PR:
PrismarineJS/prismarine-windows#73

* openContainer don't accept Furnace

* bump pwindows

Co-authored-by: Romain Beaumont <[email protected]>
  • Loading branch information
sefirosweb and rom1504 authored Sep 30, 2022
1 parent 6a626c1 commit c22d61c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
22 changes: 6 additions & 16 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export interface Bot extends TypedEmitter<BotEvents> {
pages: string[]
) => Promise<void>

openContainer: (chest: Block | Entity, direction?: Vec3, cursorPos?: Vec3) => Promise<Chest | Furnace | Dispenser>
openContainer: (chest: Block | Entity, direction?: Vec3, cursorPos?: Vec3) => Promise<Chest | Dispenser>

openChest: (chest: Block | Entity, direction?: number, cursorPos?: Vec3) => Promise<Chest>

Expand Down Expand Up @@ -617,9 +617,7 @@ interface ConditionalStorageEvents extends StorageEvents {
ready: () => void
}

export class Chest extends (EventEmitter as new () => TypedEmitter<StorageEvents>) {
window: object | /* prismarine-windows ChestWindow */ null

export class Chest extends Window<StorageEvents> {
constructor ();

close (): void;
Expand All @@ -635,13 +633,9 @@ export class Chest extends (EventEmitter as new () => TypedEmitter<StorageEvents
metadata: number | null,
count: number | null
): Promise<void>;

count (itemType: number, metadata: number | null): number;

items (): Item[];
}

export class Furnace extends (EventEmitter as new () => TypedEmitter<FurnaceEvents>) {
export class Furnace extends Window<FurnaceEvents> {
fuel: number
progress: number

Expand Down Expand Up @@ -674,7 +668,7 @@ export class Furnace extends (EventEmitter as new () => TypedEmitter<FurnaceEven
outputItem (): Item;
}

export class Dispenser extends (EventEmitter as new () => TypedEmitter<StorageEvents>) {
export class Dispenser extends Window<StorageEvents> {
constructor ();

close (): void;
Expand All @@ -690,13 +684,9 @@ export class Dispenser extends (EventEmitter as new () => TypedEmitter<StorageEv
metadata: number | null,
count: number | null
): Promise<void>;

count (itemType: number, metadata: number | null): number;

items (): Item[];
}

export class EnchantmentTable extends (EventEmitter as new () => TypedEmitter<ConditionalStorageEvents>) {
export class EnchantmentTable extends Window<ConditionalStorageEvents> {
enchantments: Enchantment[]

constructor ();
Expand Down Expand Up @@ -725,7 +715,7 @@ export interface Enchantment {
level: number
}

export class Villager extends (EventEmitter as new () => TypedEmitter<ConditionalStorageEvents>) {
export class Villager extends Window<ConditionalStorageEvents> {
trades: VillagerTrade[]

constructor ();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"prismarine-physics": "^1.3.1",
"prismarine-recipe": "^1.1.0",
"prismarine-registry": "^1.0.0",
"prismarine-windows": "^2.4.2",
"prismarine-windows": "^2.5.0",
"prismarine-world": "^3.6.0",
"protodef": "^1.14.0",
"typed-emitter": "^1.0.0",
Expand Down

0 comments on commit c22d61c

Please sign in to comment.