peer_data: Remove over defensive `assert_number` function.

Removes the `assert_number` over defensive function which was being used
for validating the type of `stream_id` but now that this module is
converted to TypeScript we do not need this function anymore since
typescript compiler will do the type checking for us.
This commit is contained in:
Lalit 2023-07-08 13:18:42 +05:30 committed by Tim Abbott
parent de6f21545b
commit e06726a5cf
2 changed files with 0 additions and 9 deletions

View File

@ -11,17 +11,9 @@ export function clear_for_testing(): void {
stream_subscribers.clear();
}
function assert_number(id: number): void {
if (typeof id !== "number") {
blueslip.error("You must pass ids as numbers to peer_data", {id});
}
}
function get_user_set(stream_id: number): LazySet {
// This is an internal function to get the LazySet of users.
// We create one on the fly as necessary, but we warn in that case.
assert_number(stream_id);
if (!sub_store.get(stream_id)) {
blueslip.warn(`We called get_user_set for an untracked stream: ${stream_id}`);
}

View File

@ -275,7 +275,6 @@ test("is_subscriber_subset", () => {
blueslip.reset();
// Warn about hypothetical undefined stream_ids.
blueslip.expect("error", "You must pass ids as numbers to peer_data");
blueslip.expect("warn", "We called get_user_set for an untracked stream: undefined");
peer_data.is_subscriber_subset(undefined, sub_a.stream_id);
blueslip.reset();