diff --git a/src/index.js b/src/index.js index 11bc73b..7e08404 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,8 @@ import { fromBinary, fromJson, toBinary, toJson } from '@bufbuild/protobuf' import * as Packets from '../generated/ares_pb.js' +/** @typedef {ReturnType} Client */ + export function create_client({ socket_write, socket_end }) { const controller = new AbortController() const stream = new PassThrough({ diff --git a/src/types.d.ts b/src/types.d.ts index 8ef7fe7..f5c62b9 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -29,6 +29,8 @@ export interface TypedEmitter { removeAllListeners(): this } +type Client = import('./index').Client + type Position = { x: number y: number diff --git a/types/src/chunk.d.ts b/types/src/chunk.d.ts index 1534f19..af52f0c 100644 --- a/types/src/chunk.d.ts +++ b/types/src/chunk.d.ts @@ -1,10 +1,17 @@ export function to_chunk_position(position: any): { - x: number; - z: number; -}; -export function spiral_array(center: any, min_distance: any, max_distance: any): any[]; -export function square_array(center: any, max_distance: any): { - x: number; - z: number; -}[]; -export const CHUNK_SIZE: 500; + x: number + z: number +} +export function spiral_array( + center: any, + min_distance: any, + max_distance: any, +): any[] +export function square_array( + center: any, + max_distance: any, +): { + x: number + z: number +}[] +export const CHUNK_SIZE: 500 diff --git a/types/src/create_spell.d.ts b/types/src/create_spell.d.ts index cb0ff5c..336ce12 100644 --- a/types/src/create_spell.d.ts +++ b/types/src/create_spell.d.ts @@ -1 +1 @@ -export {}; +export {} diff --git a/types/src/index.d.ts b/types/src/index.d.ts index 07fe086..083cad5 100644 --- a/types/src/index.d.ts +++ b/types/src/index.d.ts @@ -1,3 +1,4 @@ +/** @typedef {ReturnType} Client */ export function create_client({ socket_write, socket_end }: { socket_write: any; socket_end: any; @@ -14,4 +15,5 @@ export function create_client({ socket_write, socket_end }: { /** @type {(message: ArrayBuffer) => void} */ notify_message(message: ArrayBuffer): void; }; +export type Client = ReturnType; import { PassThrough } from 'stream';