@rbxts/types 1.0.606 → 1.0.607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/include/lua.d.ts +25 -43
  2. package/package.json +1 -1
package/include/lua.d.ts CHANGED
@@ -47,55 +47,37 @@ declare function tonumber(arg: unknown, base?: number): number | undefined;
47
47
  /** Receives an argument of any type and converts it to a string in a reasonable format. If the metatable of e has a "__tostring" field, then tostring calls the corresponding value with e as an argument and uses the result of the call as its result. For complete control of how numbers are converted, use string.format. */
48
48
  declare function tostring(value: unknown): string;
49
49
 
50
- /** Calls the function func with the given arguments in protected mode. This means that any error inside func is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message. */
51
- declare function pcall<T extends Array<any>, U>(
52
- func: (...args: T) => U,
53
- ): LuaTuple<
54
- U extends [infer A]
55
- ? [true, A] | [false, unknown]
56
- : U extends [infer A, infer B]
57
- ? [true, A, B] | [false, unknown, undefined]
58
- : U extends [infer A, infer B, infer C]
59
- ? [true, A, B, C] | [false, unknown, undefined, undefined]
60
- : U extends [infer A, infer B, infer C, infer D]
61
- ? [true, A, B, C, D] | [false, unknown, undefined, undefined, undefined]
62
- : U extends [infer A, infer B, infer C, infer D, infer E]
63
- ? [true, A, B, C, D, E] | [false, unknown, undefined, undefined, undefined, undefined]
64
- : U extends [infer A, infer B, infer C, infer D, infer E, infer F]
65
- ? [true, A, B, C, D, E, F] | [false, unknown, undefined, undefined, undefined, undefined, undefined]
66
- : [true, U] | [false, unknown]
67
- >;
68
-
69
- /** Calls the function func with the given arguments in protected mode. This means that any error inside func is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message. */
50
+ /**
51
+ * Calls the function `func` with the given arguments in protected mode. This means that any error inside `func` is not
52
+ * propagated; instead, pcall catches the error and returns a status code. Its first result is the status code
53
+ * (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the
54
+ * call, after this first result. In case of any error, pcall returns false plus the error message.
55
+ */
56
+ declare function pcall<T extends Array<any>, U extends Array<any>>(
57
+ func: (...args: T) => LuaTuple<U>,
58
+ ...args: T
59
+ ): LuaTuple<[true, ...U] | [false, ...{ [K in keyof U]: K extends "0" ? unknown : undefined }]>;
70
60
  declare function pcall<T extends Array<any>, U>(
71
61
  func: (...args: T) => U,
72
62
  ...args: T
73
- ): LuaTuple<
74
- U extends [infer A]
75
- ? [true, A] | [false, unknown]
76
- : U extends [infer A, infer B]
77
- ? [true, A, B] | [false, unknown, undefined]
78
- : U extends [infer A, infer B, infer C]
79
- ? [true, A, B, C] | [false, unknown, undefined, undefined]
80
- : U extends [infer A, infer B, infer C, infer D]
81
- ? [true, A, B, C, D] | [false, unknown, undefined, undefined, undefined]
82
- : U extends [infer A, infer B, infer C, infer D, infer E]
83
- ? [true, A, B, C, D, E] | [false, unknown, undefined, undefined, undefined, undefined]
84
- : U extends [infer A, infer B, infer C, infer D, infer E, infer F]
85
- ? [true, A, B, C, D, E, F] | [false, unknown, undefined, undefined, undefined, undefined, undefined]
86
- : [true, U] | [false, unknown]
87
- >;
88
-
89
- /** Calls the function func with the given arguments in protected mode. This means that any error inside func is not propagated; instead, xpcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, xpcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message. */
90
- declare function xpcall<T extends Array<unknown>, U, V>(
63
+ ): LuaTuple<[true, U] | [false, unknown]>;
64
+
65
+ /**
66
+ * Calls the function `func` with the given arguments in protected mode. This means that any error inside `func` is not
67
+ * propagated; instead, xpcall catches the error and returns a status code. Its first result is the status code
68
+ * (a boolean), which is true if the call succeeds without errors. In such case, xpcall also returns all results from
69
+ * the call, after this first result. In case of any error, pcall returns false plus the error message.
70
+ */
71
+ declare function xpcall<T extends Array<any>, U extends Array<any>, V>(
72
+ func: (...args: T) => LuaTuple<U>,
73
+ errHandler: (err: unknown) => V,
74
+ ...args: T
75
+ ): LuaTuple<[true, ...U] | [false, ...{ [K in keyof U]: K extends "0" ? V : undefined }]>;
76
+ declare function xpcall<T extends Array<any>, U, V>(
91
77
  func: (...args: T) => U,
92
78
  errHandler: (err: unknown) => V,
93
79
  ...args: T
94
- ): LuaTuple<
95
- U extends LuaTuple<[...infer W]>
96
- ? [true, ...W] | [false, V extends LuaTuple<[infer A, ...Array<unknown>]> ? A : V]
97
- : [true, U] | [false, V extends LuaTuple<[infer A, ...Array<unknown>]> ? A : V]
98
- >;
80
+ ): LuaTuple<[true, U] | [false, V]>;
99
81
 
100
82
  interface LuaMetatable<T> {
101
83
  __index?: (self: T, index: unknown) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/types",
3
- "version": "1.0.606",
3
+ "version": "1.0.607",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },