From ab04a86dba85d00e9701c4a124c1027a9d7c11fd Mon Sep 17 00:00:00 2001 From: Dionysusnu <39664950+Dionysusnu@users.noreply.github.com> Date: Sun, 14 May 2023 19:06:53 +0200 Subject: [PATCH] Carry over extra comments from custom definitions --- include/customDefinitions.d.ts | 36 +++------------- include/generated/None.d.ts | 59 +++++++++++++++++++++++++++ include/generated/PluginSecurity.d.ts | 41 ------------------- src/class/ClassGenerator.ts | 36 +++++++++------- 4 files changed, 86 insertions(+), 86 deletions(-) diff --git a/include/customDefinitions.d.ts b/include/customDefinitions.d.ts index 93d3c6a30..eea63cd9d 100644 --- a/include/customDefinitions.d.ts +++ b/include/customDefinitions.d.ts @@ -244,7 +244,6 @@ interface GamepadService extends Instance { } interface GamePassService extends Instance { - /** This item is deprecated. Do not use it for new work. */ PlayerHasPass(this: GamePassService, player: Player, gamePassId: number): boolean; } @@ -387,19 +386,11 @@ interface InsertService extends Instance { interface Instance { /** - * **Clone** creates a copy of an object and all of its descendants, ignoring all objects that are not [Archivable](https://developer.roblox.com/en-us/api-reference/property/Instance/Archivable). The copy of the root object is returned by this function and its [Parent](https://developer.roblox.com/en-us/api-reference/property/Instance/Parent) is set to nil. - * - * If a reference property such as [ObjectValue.Value](https://developer.roblox.com/en-us/api-reference/property/ObjectValue/Value) is set in a cloned object, the value of the copy's property depends on original's value: - * - * * If a reference property refers to an object that was **also** cloned, an _internal reference_, the copy will refer to the copy. - * * If a reference property refers to an object that was **not** cloned, an _external reference_, the same value is maintained in the copy. - * - * This function is typically used to create models that can be regenerated. First, get a reference to the original object. Then, make a copy of the object and insert the copy by setting its [Parent](https://developer.roblox.com/en-us/api-reference/property/Instance/Parent) to the [Workspace](https://developer.roblox.com/en-us/api-reference/class/Workspace) or one of its descendants. Finally, when it's time to regenerate the model, [Destroy](https://developer.roblox.com/en-us/api-reference/function/Instance/Destroy) the copy and clone a new one from the original like before. - * * Clone will return nil if the root object has Archivable set to false. */ Clone(this: T): T; - /** `Instance.Changed` has been intentionally excluded from the roblox-ts type system to maintain soundness with the ValueBase objects. + /** + * `Instance.Changed` has been intentionally excluded from the roblox-ts type system to maintain soundness with the ValueBase objects. * Please intersect your type with the `ChangedSignal` global type to unsafely access the `Instance.Changed` event. * @example * function f(p: Part) { @@ -611,9 +602,6 @@ interface Player extends Instance { readonly UserId: number; ReplicationFocus: BasePart | undefined; readonly Chatted: RBXScriptSignal<(message: string, recipient?: Player) => void>; - /** ### TS Usage - * One should check the LocationType of each member of this array in order to verify which members are present. Should be compared to the LocationType const enum. - */ GetFriendsOnline(this: Player, maxFriends?: number): Array; /** @server */ LoadCharacter(this: Player): void; @@ -693,13 +681,13 @@ interface PluginToolbar extends Instance { } interface PolicyService extends Instance { - /** Returns policy information about a player which is based on geolocation, age group, and platform. */ GetPolicyInfoForPlayerAsync(this: PolicyService, player: Player): PolicyInfo; } interface RemoteEvent extends Instance { readonly OnClientEvent: RBXScriptSignal; - /** The reason we DON'T allow you to use `Parameters` here is because you can't trust data from the client. Please type-check and sanity-check all values received from the client. E.g. if you are expecting a number from the client, you should check whether the received value is indeed a number and you might also want to make sure it isn't a `NaN` value. See example code: + /** + * The reason we DON'T allow you to use `Parameters` here is because you can't trust data from the client. Please type-check and sanity-check all values received from the client. E.g. if you are expecting a number from the client, you should check whether the received value is indeed a number and you might also want to make sure it isn't a `NaN` value. See example code: * ```ts * (new Instance("RemoteEvent") as RemoteEvent<(num: number) => void>).OnServerEvent.Connect((plr, num) => { * if (typeIs(num, "number") && num === num) { @@ -739,9 +727,7 @@ interface RunService extends Instance { } interface ScriptContext extends Instance { - /** - * `script` will be `undefined` if the error originates from either the command bar or the F9 console - */ + /** `script` will be `undefined` if the error originates from either the command bar or the F9 console */ readonly Error: RBXScriptSignal<(message: string, stackTrace: string, script?: LuaSourceContainer) => void>; } @@ -1028,22 +1014,12 @@ interface Workspace extends WorldRoot { } interface WorldRoot extends Model { - /** - * Casts a ray using an origin, direction, and optional `RaycastParams`. If it finds an eligible `BasePart` or `Terrain` cell, a `RaycastResult` is returned containing the results of the operation. If no `RaycastParams` object is provided, the defaults are used (all parts are considered and Terrain water is not ignored). - * - * Note that the length (magnitude) of the directional vector is important, as objects/terrain further away than its length will not be tested. If you’re using a `CFrame` to help create the ray components, consider using `CFrame.LookVector` as the directional vector and multiply it by the desired length as shown in the example below. - * - * For a demonstration of how raycasting works, see the Intro to Raycasting article. - * - * This method does NOT use a `Ray` object, but its origin and direction components can be borrowed from `Ray.Origin` and `Ray.Direction`. - */ Raycast( this: WorldRoot, origin: Vector3, direction: Vector3, raycastParams?: RaycastParams, ): RaycastResult | undefined; - /** @deprecated in favor of WorldRoot.Raycast */ FindPartOnRay( this: WorldRoot, ray: Ray, @@ -1051,7 +1027,6 @@ interface WorldRoot extends Model { terrainCellsAreCubes?: boolean, ignoreWater?: boolean, ): LuaTuple<[BasePart | undefined, Vector3, Vector3, Enum.Material]>; - /** @deprecated in favor of WorldRoot.Raycast */ FindPartOnRayWithIgnoreList( this: WorldRoot, ray: Ray, @@ -1059,7 +1034,6 @@ interface WorldRoot extends Model { terrainCellsAreCubes?: boolean, ignoreWater?: boolean, ): LuaTuple<[BasePart | undefined, Vector3, Vector3, Enum.Material]>; - /** @deprecated in favor of WorldRoot.Raycast */ FindPartOnRayWithWhitelist( this: WorldRoot, ray: Ray, diff --git a/include/generated/None.d.ts b/include/generated/None.d.ts index f230217b9..5572eb0ee 100644 --- a/include/generated/None.d.ts +++ b/include/generated/None.d.ts @@ -652,6 +652,8 @@ interface Instance { * * If a reference property refers to an object that was **not** cloned, an _external reference_, the same value is maintained in the copy. * * This function is typically used to create models that can be regenerated. First, get a reference to the original object. Then, make a copy of the object and insert the copy by setting its [Parent](https://developer.roblox.com/en-us/api-reference/property/Instance/Parent) to the [Workspace](https://developer.roblox.com/en-us/api-reference/class/Workspace) or one of its descendants. Finally, when it's time to regenerate the model, [Destroy](https://developer.roblox.com/en-us/api-reference/function/Instance/Destroy) the copy and clone a new one from the original like before. + * + * Clone will return nil if the root object has Archivable set to false. */ Clone(this: T): T; /** @@ -1070,6 +1072,13 @@ interface Instance { * This event does not fire for physics-related changes, like when the `CFrame`, `Velocity`, `RotVelocity`, `Position`, `Orientation` and `CFrame` properties of a [BasePart](https://developer.roblox.com/en-us/api-reference/class/BasePart) change due to gravity. To detect changes in these properties, consider using a physics-based event like `RunService.Stepped` or `BasePart.Touched`. A while-true-do loop can also work. * * For “-Value” objects, this event behaves differently: it only fires when the `Value` property changes. See individual pages for [IntValue](https://developer.roblox.com/en-us/api-reference/class/IntValue), [StringValue](https://developer.roblox.com/en-us/api-reference/class/StringValue), etc for more information. To detect other changes in these objects, you must use `GetPropertyChangedSignal` instead. + * + * `Instance.Changed` has been intentionally excluded from the roblox-ts type system to maintain soundness with the ValueBase objects. + * Please intersect your type with the `ChangedSignal` global type to unsafely access the `Instance.Changed` event. + * @example + * function f(p: Part) { + * (p as Part & ChangedSignal).Changed.Connect(changedPropertyName => {}) + * } */ readonly Changed: unknown; /** @@ -3032,6 +3041,7 @@ interface BadgeService extends Instance { * * * [BadgeService:GetBadgeInfoAsync()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/GetBadgeInfoAsync) * * [BadgeService:UserHasBadgeAsync()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync) + * @server * Tags: Yields */ AwardBadge(this: BadgeService, userId: number, badgeId: number): boolean; @@ -3073,6 +3083,7 @@ interface BadgeService extends Instance { * * * [BadgeService:AwardBadge()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/AwardBadge) * * [BadgeService:UserHasBadgeAsync()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync) + * @server * Tags: Yields */ GetBadgeInfoAsync(this: BadgeService, badgeId: number): BadgeInfo; @@ -3128,6 +3139,7 @@ interface BadgeService extends Instance { * * * [BadgeService:GetBadgeInfoAsync()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/GetBadgeInfoAsync) * * [BadgeService:AwardBadge()](https://developer.roblox.com/en-us/api-reference/function/BadgeService/AwardBadge) + * @server * Tags: Yields */ UserHasBadgeAsync(this: BadgeService, userId: number, badgeId: number): boolean; @@ -14545,6 +14557,7 @@ interface HttpService extends Instance { * The GetAsync function sends an HTTP GET request. It functions similarly to [RequestAsync](https://developer.roblox.com/en-us/api-reference/function/HttpService/RequestAsync) except that it accepts HTTP request parameters as method parameters instead of a single dictionary and returns only the body of the HTTP response. Generally, this method is useful only as a shorthand and [RequestAsync](https://developer.roblox.com/en-us/api-reference/function/HttpService/RequestAsync) should to be used in most cases. For a detailed guide on sending and retrieving data via HTTP requests, see the [Sending HTTP Requests](https://developer.roblox.com/articles/Sending-HTTP-requests) article. * * When true, the `nocache` parameter prevents this function from caching results from previous calls with the same `url`. + * @server * Tags: Yields */ GetAsync(this: HttpService, url: string, nocache?: boolean, headers?: HttpHeaders): string; @@ -14552,6 +14565,7 @@ interface HttpService extends Instance { * The PostAsync function sends an HTTP POST request. It functions similarly to [RequestAsync](https://developer.roblox.com/en-us/api-reference/function/HttpService/RequestAsync) except that it accepts HTTP request parameters as method parameters instead of a single dictionary and returns only the body of the HTTP response. Generally, this method is useful only as a shorthand and [RequestAsync](https://developer.roblox.com/en-us/api-reference/function/HttpService/RequestAsync) should to be used in most cases. For a detailed guide on sending and retrieving data via HTTP requests, see the [Sending HTTP Requests](https://developer.roblox.com/articles/Sending-HTTP-requests) article. * * When true, the `compress` parameter controls whether large request bodies will be compressed using gzip. + * @server * Tags: Yields */ PostAsync( @@ -14662,6 +14676,7 @@ interface HttpService extends Instance { * ----------- * * The current limitation for sending and receiving HTTP requests is 500 requests per minute. Requests over this threshold will fail. Additionally, Roblox domains are blacklisted. This means that HTTP requests cannot be sent to any Roblox owned site, such as [www.roblox.com](https://www.roblox.com). + * @server * Tags: Yields */ RequestAsync(this: HttpService, requestOptions: RequestAsyncRequest): RequestAsyncResponse; @@ -23213,6 +23228,7 @@ interface BasePart extends PVInstance { * ##See Also * * * [Network ownership](https://developer.roblox.com/articles/Network-Ownership) + * @server */ CanSetNetworkOwnership(this: BasePart): LuaTuple<[boolean, string | undefined]>; /** @@ -23246,10 +23262,12 @@ interface BasePart extends PVInstance { GetMass(this: BasePart): number; /** * Returns the current player who is the network owner of this part, or nil in case of the server. + * @server */ GetNetworkOwner(this: BasePart): Player | undefined; /** * Returns true if the game engine automatically decides the network owner for this part. + * @server */ GetNetworkOwnershipAuto(this: BasePart): boolean; /** @@ -23324,10 +23342,12 @@ interface BasePart extends PVInstance { * -------- * * * [NetworkOwnership](https://developer.roblox.com/articles/Network-Ownership "NetworkOwnership") + * @server */ SetNetworkOwner(this: BasePart, playerInstance?: Player): void; /** * Lets the game engine dynamically decide who will handle the part's physics (one of the clients or the server). + * @server */ SetNetworkOwnershipAuto(this: BasePart): void; /** @@ -23343,6 +23363,7 @@ interface BasePart extends PVInstance { * local pinkParts = {workspace.PinkPart, workspace.PinkPart2} * local union = yellowPart:SubtractAsync(pinkParts) * union.Parent = workspace + * @server * Tags: Yields */ SubtractAsync( @@ -23415,6 +23436,7 @@ interface BasePart extends PVInstance { * * [In Game Solid Modeling](https://developer.roblox.com/en-us/articles/in-game-solid-modeling), create custom plugins for solid modeling techniques like unions, negations, and separations * * [3D Modeling with Parts](https://developer.roblox.com/en-us/articles/3d-modeling-with-parts), how to combine and subtract parts to create complex solid shapes * * [Making an Arch](https://developer.roblox.com/en-us/articles/making-an-arch), make an arch for your environment using the Negate tool + * @server * Tags: Yields */ UnionAsync( @@ -27080,6 +27102,7 @@ interface Player extends Instance { * 7. The Character rig builds, and the Character scales * 8. Character moves to the spawn location * 9. LoadCharacter returns + * @server * Tags: Yields */ LoadCharacter(this: Player): void; @@ -27092,6 +27115,7 @@ interface Player extends Instance { * -------- * * * [Humanoid Description System](https://developer.roblox.com/en-us/articles/humanoiddescription-system), an article which explains the humanoid description system in greater detail and provides several scripting examples + * @server * Tags: Yields */ LoadCharacterWithHumanoidDescription(this: Player, humanoidDescription: HumanoidDescription): void; @@ -27316,6 +27340,7 @@ interface Players extends Instance { * local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait() * * Doing this isn't for a [LocalScript](https://developer.roblox.com/en-us/api-reference/class/LocalScript) within [StarterGui](https://developer.roblox.com/en-us/api-reference/class/StarterGui), [StarterPlayerScripts](https://developer.roblox.com/en-us/api-reference/class/StarterPlayerScripts) or [StarterCharacterScripts](https://developer.roblox.com/en-us/api-reference/class/StarterCharacterScripts): these scripts can only run after a [Player](https://developer.roblox.com/en-us/api-reference/class/Player) object is already available, and LocalPlayer will have been set by then. + * @client * Tags: ReadOnly, NotReplicated */ readonly LocalPlayer: Player; @@ -28386,6 +28411,17 @@ interface RemoteEvent extends Instance { * This is used to retrieve remote events fired by the client and intended for the server. This event is in place to provide a method for communicating between the client and server, which is well documented in [this](https://developer.roblox.com/articles/Remote-Functions-and-Events) article. This event retrieves remote events fired by the client to the server. * * To fire from the server to the client, you should use [RemoteEvent:FireClient](https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireClient) and [RemoteEvent.OnClientEvent](https://developer.roblox.com/en-us/api-reference/event/RemoteEvent/OnClientEvent). + * + * The reason we DON'T allow you to use `Parameters` here is because you can't trust data from the client. Please type-check and sanity-check all values received from the client. E.g. if you are expecting a number from the client, you should check whether the received value is indeed a number and you might also want to make sure it isn't a `NaN` value. See example code: + * ```ts + * (new Instance("RemoteEvent") as RemoteEvent<(num: number) => void>).OnServerEvent.Connect((plr, num) => { + * if (typeIs(num, "number") && num === num) { + * print(`Yay! Valid number: ${num}`); + * } else { + * print(`Bad argument received from ${plr.Name}! Exploit or bug?`); + * } + * }); + * ``` */ readonly OnServerEvent: RBXScriptSignal<(player: Player, ...args: Array) => void>; } @@ -28467,6 +28503,18 @@ interface RemoteFunction extends Instance { */ readonly RemoteOnInvokeSuccess: RBXScriptSignal<(id: number, arguments: Array) => void>; OnClientInvoke: T | undefined; + /** + * The reason we DON'T allow you to use `Parameters` here is because you can't trust data from the client. Please type-check and sanity-check all values received from the client. E.g. if you are expecting a number from the client, you should check whether the received value is indeed a number and you might also want to make sure it isn't a `NaN` value. See example code: + * ```ts + * (new Instance("RemoteFunction") as RemoteFunction<(num: number) => void>).OnServerInvoke = (plr, num) => { + * if (typeIs(num, "number") && num === num) { + * print(`Yay! Valid number: ${num}`); + * } else { + * print(`Bad argument received from ${plr.Name}! Exploit or bug?`); + * } + * }; + * ``` + */ OnServerInvoke: ((player: Player, ...args: Array) => void) | undefined; } @@ -29047,6 +29095,7 @@ interface ScriptContext extends Instance { readonly _nominal_ScriptContext: unique symbol; /** * Fired when an error occurs. + * `script` will be `undefined` if the error originates from either the command bar or the F9 console */ readonly Error: RBXScriptSignal<(message: string, stackTrace: string, script?: LuaSourceContainer) => void>; } @@ -31837,12 +31886,14 @@ interface TeleportService extends Instance { * ----------------- * * This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application. + * @client */ GetArrivingTeleportGui(this: TeleportService): ScreenGui | undefined; /** * This function returns the teleport data the [Players.LocalPlayer](https://developer.roblox.com/en-us/api-reference/property/Players/LocalPlayer) arrived with. It can only be called from the client. * * Exploiters can spoof teleport data. Send secure data such as player currency through a server-side service such as \`DataStoreService\` to prevent tampering. + * @client */ GetLocalPlayerTeleportData(this: TeleportService): unknown; /** @@ -31881,6 +31932,7 @@ interface TeleportService extends Instance { * ----------------- * * This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application. + * @client */ GetTeleportSetting(this: TeleportService, setting: string): unknown; /** @@ -31903,6 +31955,7 @@ interface TeleportService extends Instance { * ----------------- * * This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application. + * @client */ SetTeleportGui(this: TeleportService, gui: ScreenGui): void; /** @@ -31949,6 +32002,7 @@ interface TeleportService extends Instance { * ----------------- * * This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application. + * @client */ SetTeleportSetting(this: TeleportService, setting: string, value: TeleportData): void; /** @@ -32257,6 +32311,7 @@ interface TeleportService extends Instance { * -------- * * * For the [PlaceIds](https://developer.roblox.com/en-us/api-reference/property/DataModel/PlaceId) and [JobIds](https://developer.roblox.com/en-us/api-reference/property/DataModel/JobId) of a [Player's](https://developer.roblox.com/en-us/api-reference/class/Player) friends, use [Player:GetFriendsOnline](https://developer.roblox.com/en-us/api-reference/function/Player/GetFriendsOnline) + * @server * Tags: Yields */ GetPlayerPlaceInstanceAsync(this: TeleportService, userId: number): LuaTuple<[boolean, string, number, string]>; @@ -32289,6 +32344,7 @@ interface TeleportService extends Instance { * ------------------- * * Players on Xbox One with cross-platform play disabled will arrive in a different server with players with cross-platform play enabled. This can cause multiple game servers with the same PrivateServerId to exist. + * @server * Tags: Yields */ ReserveServer(this: TeleportService, placeId: number): LuaTuple<[string, string]>; @@ -32347,6 +32403,7 @@ interface TeleportService extends Instance { * -------- * * For an in-depth guide on teleporting players and properly handling teleport failures, see the [Teleporting Between Places](https://developer.roblox.com/articles/Teleporting-Between-Places) article. + * @server * Tags: Yields */ TeleportAsync( @@ -32880,6 +32937,7 @@ interface TextService extends Instance { * * This method always yields to make a text filtering service call * * This method may throw if there is a service error that can not be resolved. If this function throws an error please do not retry the request; this method implements it's own retry logic internally. If this method fails do not display the text to any user. * * This method currently throws if _fromUserId_ is not online on the current server. We plan to support users who are offline or on a different server in the future. + * @server * Tags: Yields */ FilterStringAsync( @@ -35899,6 +35957,7 @@ interface UserService extends Instance { * * It's possible to receive less `UserInfoResponse` objects than requested if one or more of the `userIds` in the request array are invalid, such as negative numbers or user ID's that don't have accounts associated with them. It's possible to receive a response with zero results if all userIds are invalid. * * If a Roblox user does not have a display name associated with their account, the function will return instead the same string as the user's username in the `DisplayName` field. See [Player.DisplayName](https://developer.roblox.com/api-reference/property/Player/DisplayName). While a user's UserId will never change, a user may change their username or display name. The same input `UserIds` may return a different string for these fields from one day to another. * * Since `GetUserInfosByUserIdsAsync()` makes an external web request, it will yield and may fail if the backend service is experiencing interruptions. Ensure you can handle downtime appropriately by wrapping the method with a pcall. + * @server * Tags: Yields */ GetUserInfosByUserIdsAsync(this: UserService, userIds: Array): Array; diff --git a/include/generated/PluginSecurity.d.ts b/include/generated/PluginSecurity.d.ts index 6307122ea..64096198f 100644 --- a/include/generated/PluginSecurity.d.ts +++ b/include/generated/PluginSecurity.d.ts @@ -1292,47 +1292,6 @@ interface Workspace extends WorldRoot { * @deprecated */ readonly _nominal_Workspace: unique symbol; - /** - * Goes through all [BasePart](https://developer.roblox.com/en-us/api-reference/class/BasePart)s given, breaking any joints connected to these parts. - * - * This function will break any of the following types of joints: - * - * * [JointInstance](https://developer.roblox.com/en-us/api-reference/class/JointInstance)s such as `Connectors`, `Welds` and `Snaps` - * * [WeldConstraint](https://developer.roblox.com/en-us/api-reference/class/WeldConstraint)s - * - * Unlike `Break/MakeJoints`, this function requires an array of [BasePart](https://developer.roblox.com/en-us/api-reference/class/BasePart)s as a parameter. This array is given as follows: - * - * workspace:BreakJoints({part1, part2, part3}) - * - * Note, this function cannot be used by scripts and will only function in plugins. - * Tags: Deprecated - * @deprecated - */ - readonly BreakJoints: never; - /** - * **Deprecated** - * - * SurfaceType based joining is deprecated, do not use MakeJoints for new projects. [WeldConstraints](https://developer.roblox.com/en-us/api-reference/class/WeldConstraint) and [HingeConstraints](https://developer.roblox.com/en-us/api-reference/class/HingeConstraint) should be used instead - * - * Goes through all [Parts](https://developer.roblox.com/en-us/api-reference/class/BasePart) given. If any part's side has a [SurfaceType](https://developer.roblox.com/en-us/api-reference/enum/SurfaceType) that can make a joint it will create a joint with any adjacent parts. - * - * Joints will be created between the specified Parts and any planar touching surfaces, depending on the parts' surfaces. - * - * * Smooth surfaces will not create joints - * * Glue surfaces will create a [Glue](https://developer.roblox.com/en-us/api-reference/class/Glue) joint - * * Weld will create a [Weld](https://developer.roblox.com/en-us/api-reference/class/Weld) joint with any surface except for Unjoinable - * * Studs, Inlet, or Universal will each create a [Snap](https://developer.roblox.com/en-us/api-reference/class/Snap) joint with either of other the other two surfaces (e.g. Studs with Inlet and Universal) - * * Hinge and Motor surfaces create [Rotate](https://developer.roblox.com/en-us/api-reference/class/Rotate) and [RotateV](https://developer.roblox.com/en-us/api-reference/class/RotateV) joint instances - * - * Unlike [Model:MakeJoints](https://developer.roblox.com/en-us/api-reference/function/Model/MakeJoints), this function requires an array of parts as a parameter. This array is given as follows: - * - * workspace:MakeJoints({part1, part2, part3}) - * - * Joints are broken if enough force is applied to them due to an [Explosion](https://developer.roblox.com/en-us/api-reference/class/Explosion), unless a [ForceField](https://developer.roblox.com/en-us/api-reference/class/ForceField) object is parented to the [BasePart](https://developer.roblox.com/en-us/api-reference/class/BasePart) or ancestor [Model](https://developer.roblox.com/en-us/api-reference/class/Model). For this reason, they are often used to make simple destructible buildings and other models. - * Tags: Deprecated - * @deprecated - */ - readonly MakeJoints: never; /** * Positions and zooms the [Workspace.CurrentCamera](https://developer.roblox.com/en-us/api-reference/property/Workspace/CurrentCamera) to show the extent of [BasePart](https://developer.roblox.com/en-us/api-reference/class/BasePart)s currently in the [Workspace](https://developer.roblox.com/en-us/api-reference/class/Workspace). * diff --git a/src/class/ClassGenerator.ts b/src/class/ClassGenerator.ts index 3b0976302..1697631cf 100644 --- a/src/class/ClassGenerator.ts +++ b/src/class/ClassGenerator.ts @@ -253,7 +253,9 @@ const CLASS_BLACKLIST = new Set([ ]); const MEMBER_BLACKLIST = new Map([ - ["Workspace", new Set(["FilteringEnabled"])], + // Joint functions are overridden with `never` in customDefinitions.d.ts, which ignores blacklist + // Specifying them here prevents them from becoming duplicated in PluginSecurity.d.ts + ["Workspace", new Set(["FilteringEnabled", "MakeJoints", "BreakJoints"])], ["CollectionService", new Set(["GetCollection"])], ["Instance", new Set(["children", "Remove"])], ["BodyGyro", new Set(["cframe"])], @@ -868,7 +870,7 @@ export class ClassGenerator extends Generator { let documentation = ""; const signature = node .getFullText() - .replace(/\/\*\*[^]+\*\//g, a => { + .replace(/\/\*\*([^]+)\*\//g, (_, a) => { documentation = a; return ""; }) @@ -884,6 +886,9 @@ export class ClassGenerator extends Generator { } private writeSignatures(rbxMember: ApiMemberBase, tsImplInterface?: ts.InterfaceDeclaration, description?: string) { + const descriptionParts = []; + if (description) descriptionParts.push(description); + if (tsImplInterface) { const name = rbxMember.Name; const signatures = Array(); @@ -899,31 +904,34 @@ export class ClassGenerator extends Generator { nodes .filter(prop => prop.getName() === name) .forEach(node => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const [signature, documentation] = this.getSignature(node); signatures.push(signature); - // we don't do this anymore, because of the new TS comment behavior. It automatically combines docs - // documentations.push(documentation); + + if (documentation) { + if (documentation[0] === "\n") { + // Full paragraph: Separate using an empty line + descriptionParts.push(""); + descriptionParts.push(documentation.substring(4)); + } else { + // One-line additions, like `@server` + descriptionParts.push(documentation); + } + } }); - this.writeDescription(rbxMember, description); + this.writeDescription(rbxMember, descriptionParts); const written = signatures.length > 0; if (written) { this.write(signatures.join("\n\t")); } return written; } else { - this.writeDescription(rbxMember, description); + this.writeDescription(rbxMember, descriptionParts); return false; } } - private writeDescription(rbxMember: ApiMemberBase, description?: string) { - const parts = new Array(); - if (description) { - parts.push(description); - } - + private writeDescription(rbxMember: ApiMemberBase, parts: Array) { if (rbxMember.Tags && rbxMember.Tags.length > 0) { parts.push("Tags: " + rbxMember.Tags.join(", ")); } @@ -1184,7 +1192,7 @@ export class ClassGenerator extends Generator { fatal("Unknown member", className + "." + name, "was found in customDefinitions.d.ts"); } const [signature, documentation] = this.getSignature(custom); - if (documentation.trim()) this.write(documentation); + if (documentation.trim()) this.write(`/**${documentation}*/`); this.write(signature); } }