Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to reduce usage of any in the codebase #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MTRNord
Copy link
Collaborator

@MTRNord MTRNord commented Oct 14, 2023

This also makes the usage of any be a linter error by default. In most cases, we likely don't want any. Most usages that currently exist seem to be from matrix-bot-sdk. Some are from nodejs itself.

…s if possible or otherwise ignore them with a comment of why they are ignored
@MTRNord MTRNord requested a review from Gnuxie October 14, 2023 17:55
@MTRNord MTRNord marked this pull request as ready for review October 14, 2023 17:55
@@ -213,7 +213,8 @@ async function execSinceCommandAux(destinationRoomId: string, event: any, mjolni
} else if (maybeRoom.startsWith("#") || maybeRoom.startsWith("!")) {
const roomId = await mjolnir.client.resolveRoom(maybeRoom);
if (!protectedRooms.has(roomId)) {
return mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "SinceCommand", `This room is not protected: ${htmlEscape(roomId)}.`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was found as a result of the any return type of logMessage. I fixed it with what I assume may have been intended here. But logMessage can only return void. So the return made no selve (and now causes a typescript error as it should)

@Gnuxie
Copy link
Member

Gnuxie commented Oct 16, 2023

I don't think this fundamentally changes anything. I know that having to manually disable the check would stop any creeping into new code and urge caution, but I don't know if this is the right move yet. Ultimately I want to be able to parse all incoming events so that we don't have this problem but that's probably not going to happen anytime soon. For now though encouraging unknown over any would be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants