Skip to content

Commit

Permalink
Fix: Incorrect Roblox-TS Typings (#10)
Browse files Browse the repository at this point in the history
Fixes #8 and fixes #9.
  • Loading branch information
littletsu committed Feb 5, 2024
1 parent c4d92fe commit ab04184
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/setup/matter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ Being initially made for the Matter ECS, Net provides a simple function for sche
Firstly, create a ``routes.ts`` ModuleScript in ReplicatedStorage to strictly declare your Routes.

```ts title="routes.ts"
import { Route } from "@rbxts/yetanothernet";
import { Route, Configuration } from "@rbxts/yetanothernet";

const defaultConfiguration = {
const defaultConfiguration: Configuration = {
Channel: "Reliable",
Event: "default",
}
Expand Down
15 changes: 7 additions & 8 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
type Recipient = "NET_SERVER" | Player | [Player]

type Configuration = {
Channel: "Reliable" | "Unreliable" | undefined,
Event: string | undefined,
}

/**
* Allows for modification of queued packets before they're sent.
*/
Expand Down Expand Up @@ -40,6 +35,11 @@ type QueryResult<T extends Array<any>> = Query<T> & {
declare namespace Net {
const server: "NET_SERVER";

type Configuration = {
Channel: "Reliable" | "Unreliable" | undefined,
Event: string | undefined,
}

class Route<T extends Array<any>> {
public constructor(configuration: Configuration | null);

Expand Down Expand Up @@ -96,8 +96,7 @@ declare namespace Net {
* @param loop - A Matter Loop
* @param routes - An array of your routes
*/
function start<T extends Array<any>>(loop: any, routes: Array<Route<T>>): void

function start(loop: any, routes: {[index: string]: Route<any>}): void
/**
* This function allows you to run Net scheduling code on your own events.
*
Expand All @@ -111,7 +110,7 @@ declare namespace Net {
* ```
* @param routes - An array of your routes
*/
function createHook<T extends Array<any>>(routes: Array<Route<T>>): () => void
function createHook(routes: {[index: string]: Route<any>}): () => void
}

export = Net

0 comments on commit ab04184

Please sign in to comment.