Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vorlias committed Jul 18, 2021
1 parent b67cfb0 commit 4cd9a0c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rbxts/zircon",
"version": "0.9.0-beta.0",
"version": "0.9.2-beta.0",
"description": "",
"main": "out/init.lua",
"scripts": {
Expand Down Expand Up @@ -51,6 +51,6 @@
"@rbxts/snapdragon": "2.0.0-beta.1",
"@rbxts/string-utils": "^1.0.2",
"@rbxts/t": "^1.3.5",
"@rbxts/zirconium": "^1.0.2-rc.0"
"@rbxts/zirconium": "^1.0.3"
}
}
8 changes: 6 additions & 2 deletions src/Class/ZirconFunction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LogLevel } from "@rbxts/log";
import { RunService } from "@rbxts/services";
import ZrContext from "@rbxts/zirconium/out/Data/Context";
import { ZrValue } from "@rbxts/zirconium/out/Data/Locals";
import ZrLuauFunction, { ZrLuauArgument } from "@rbxts/zirconium/out/Data/LuauFunction";
import ZrPlayerScriptContext from "@rbxts/zirconium/out/Runtime/PlayerScriptContext";
import Server from "../Server";
Expand All @@ -24,7 +25,10 @@ export class ZirconContext {
}
}

export class ZirconFunction<V extends readonly ZirconValidator<unknown, unknown>[], R> extends ZrLuauFunction {
export class ZirconFunction<
V extends readonly ZirconValidator<unknown, unknown>[],
R extends ZrValue | void
> extends ZrLuauFunction {
public constructor(
private name: string,
private argumentValidators: V,
Expand Down Expand Up @@ -65,7 +69,7 @@ export class ZirconFunction<V extends readonly ZirconValidator<unknown, unknown>
}

/// This is not pretty, I know.
this.zirconCallback(
return this.zirconCallback(
new ZirconContext(context),
...((transformedArguments as unknown) as InferArguments<V>),
);
Expand Down
3 changes: 2 additions & 1 deletion src/Class/ZirconFunctionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ZirconValidator,
} from "./ZirconTypeValidator";
import { ZirconContext, ZirconFunction } from "./ZirconFunction";
import { ZrValue } from "@rbxts/zirconium/out/Data/Locals";

export class ZirconFunctionBuilder<V extends ZirconValidator<any, any>[] = []> {
private validators = new Array<ZirconValidator<any, any>>();
Expand Down Expand Up @@ -44,7 +45,7 @@ export class ZirconFunctionBuilder<V extends ZirconValidator<any, any>[] = []> {
>;
}

public Bind(fn: (context: ZirconContext, ...args: InferArguments<V>) => void) {
public Bind<R extends ZrValue | void>(fn: (context: ZirconContext, ...args: InferArguments<V>) => R) {
return new ZirconFunction(this.name, this.validators as V, fn);
}
}

0 comments on commit 4cd9a0c

Please sign in to comment.