discordjs / website

The discord.js site what else
Other
183 stars 114 forks source link

Expanding typedefs with info/warn blocks doesn't display their properties #106

Closed ImRodry closed 3 years ago

ImRodry commented 3 years ago

When expanding an extended typedef that has an info or warn block in it, the website will not display the extended typedef's properties unless you click on the typedef link to go to its page. A good example of this is the SetApplicationCommandPermissionsOptions typedef, which looks like this when expanded image

Jiralite commented 3 years ago

After digging around, the actual issue is because the expanded type definition does not have any @property tags. The ones displayed in the screenshot are all @param tags, which aren't correct (and also signified by the heading "Parameters").

The parser detects if there are any properties. If there are no properties, it renders the description. This is exactly what's happening here! BaseApplicationCommandPermissionsOptions is defined as followed:

/**
 * Options for managing permissions for one or more Application Commands
 * <warn>When passing these options to a manager where `guildId` is `null`,
 * `guild` is a required parameter</warn>
 * @typedef {Object} BaseApplicationCommandPermissionsOptions
 * @param {GuildResolvable} [guild] The guild to modify / check permissions for
 * <warn>Ignored when the manager has a non-null `guildId` property</warn>
 * @param {ApplicationCommandResolvable} [command] The command to modify / check permissions for
 * <warn>Ignored when the manager has a non-null `commandId` property</warn>
 */

Since there are no @property tags, only the description is revealed. So... this is actually not a website issue. This is a bug in how the JSDoc is coded as, well, objects have properties.

ImRodry commented 3 years ago

Oh for some reason I never thought of that. Thanks for opening the PR! Will close this now