@rbxts/types 1.0.571 → 1.0.574

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.
package/include/lua.d.ts CHANGED
@@ -680,6 +680,15 @@ declare namespace table {
680
680
  * for tables that are to be re-used.
681
681
  */
682
682
  function clear(t: object): void;
683
+ /**
684
+ * Creates a table with the array portion allocated to the given number of elements, optionally filled with the given value.
685
+ *
686
+ * If you are inserting into large array-like tables and are certain of a reasonable upper limit to the number of elements,
687
+ * it’s recommended to use this function to initialize the table.
688
+ * This ensures the table’s array portion of its memory is sufficiently sized, as resizing it can be expensive.
689
+ * For small quantities this is typically not noticeable.
690
+ */
691
+ function create<T>(count: number, value?: T): Array<T>;
683
692
  /**
684
693
  * Sorts list elements in a given order, in-place, from `list[1]` to `list[#list]`. Comp is a function that
685
694
  * receives two list elements and returns true when the first element must come before the second in the final order
@@ -1493,6 +1493,19 @@ type FloatCurveKeyConstructor = new (
1493
1493
  ) => FloatCurveKey;
1494
1494
  declare const FloatCurveKey: FloatCurveKeyConstructor;
1495
1495
 
1496
+ // Font
1497
+ interface Font {
1498
+ Bold: boolean;
1499
+ Style: Enum.FontStyle;
1500
+ Family: string;
1501
+ Weight: Enum.FontWeight;
1502
+ }
1503
+ interface FontConstructor {
1504
+ new (family: string, weight?: Enum.FontWeight, style?: Enum.FontStyle): Font;
1505
+ fromEnum: (value: Enum.Font) => Font;
1506
+ }
1507
+ declare const Font: FontConstructor;
1508
+
1496
1509
  // NumberRange
1497
1510
  interface NumberRange {
1498
1511
  /**
@@ -2309,46 +2322,3 @@ interface CheckableTypes extends CheckablePrimitives {
2309
2322
  Vector3: Vector3;
2310
2323
  Vector3int16: Vector3int16;
2311
2324
  }
2312
-
2313
- /** Returns the type of the given object as a string. This function works similarly to Lua’s native type function, with the exceptions that Roblox-defined data types like Vector3 and CFrame return their respective data types as strings. */
2314
- declare function typeOf(value: unknown): Exclude<keyof CheckableTypes, "vector">;
2315
-
2316
- /**
2317
- * Returns true if `typeof(value) == type`, otherwise false.
2318
- * This function allows for type narrowing. i.e.
2319
- ```
2320
- // v is unknown
2321
- if (typeIs(v, "Vector3")) {
2322
- print(v.X, v.Y, v.Z);
2323
- }
2324
- ```
2325
- **/
2326
- declare function typeIs<T extends keyof CheckableTypes>(value: unknown, type: T): value is CheckableTypes[T];
2327
-
2328
- /**
2329
- * Calls the function func with the given arguments in protected mode.
2330
- *
2331
- * opcall is an easier to use version of pcall. It returns a result object instead of multiple returns.
2332
- **/
2333
- declare function opcall<T extends Array<any>, U>(
2334
- func: (...args: T) => U,
2335
- ...args: T
2336
- ): { success: true; value: U } | { success: false; error: string };
2337
-
2338
- /**
2339
- * Returns true if `instance.ClassName == Q`, otherwise false.
2340
- * This function allows for ClassName narrowing. i.e.
2341
- * @example
2342
- * if (classIs(o, "LocalScript")) {
2343
- * // o is a LocalScript
2344
- * }
2345
- * if (classIs(o, "Script")) {
2346
- * // o is a Script & { ClassName: "Script" }
2347
- * // Notice how it specifies the ClassName property here.
2348
- * // This is because a `LocalScript` is-a `Script`, but `o` refers to
2349
- * // an instance for which `ClassName` is "Script"
2350
- * }
2351
- * @param instance
2352
- * @param className
2353
- */
2354
- declare function classIs<T extends keyof Instances>(instance: Instance, className: T): instance is Instances[T];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/types",
3
- "version": "1.0.571",
3
+ "version": "1.0.574",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },