<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import { NotificationTypeJson } from 'interfaces/notification-json';
import { action, computed, observable } from 'mobx';
import NotificationStack from 'models/notification-stack';
import { NotificationContextData } from 'notifications-context';
import { NotificationCursor } from 'notifications/notification-cursor';
import { NotificationIdentity } from 'notifications/notification-identity';
import NotificationReadable from 'notifications/notification-readable';
import { NotificationResolver } from 'notifications/notification-resolver';

export type Name = null | 'beatmapset' | 'build' | 'channel' | 'forum_topic' | 'news_post' | 'user';
const names: Name[] = [null, 'beatmapset', 'build', 'channel', 'forum_topic', 'news_post', 'user'];

export const TYPES = [
  { type: null },
  { type: 'user' },
  { type: 'beatmapset' },
  { type: 'forum_topic' },
  { type: 'news_post' },
  { type: 'build' },
  { type: 'channel' },
];

export function getValidName(value: unknown) {
  const casted = value as Name;<commit_msg>fix type inference for some functions (like filter)<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

import { NotificationTypeJson } from 'interfaces/notification-json';
import { action, computed, observable } from 'mobx';
import NotificationStack from 'models/notification-stack';
import { NotificationContextData } from 'notifications-context';
import { NotificationCursor } from 'notifications/notification-cursor';
import { NotificationIdentity } from 'notifications/notification-identity';
import NotificationReadable from 'notifications/notification-readable';
import { NotificationResolver } from 'notifications/notification-resolver';

export type Name = null | 'beatmapset' | 'build' | 'channel' | 'forum_topic' | 'news_post' | 'user';
const names: Name[] = [null, 'beatmapset', 'build', 'channel', 'forum_topic', 'news_post', 'user'];

export const TYPES: { type: Name }[] = [
  { type: null },
  { type: 'user' },
  { type: 'beatmapset' },
  { type: 'forum_topic' },
  { type: 'news_post' },
  { type: 'build' },
  { type: 'channel' },
];

export function getValidName(value: unknown) {
  const casted = value as Name;
{'fraction_non_alphanumeric': 0.13522267206477734, 'fraction_numerical': 0.0016194331983805667, 'mean_word_length': 5.368556701030927, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '818708', 'n_tokens_mistral': 728, 'n_tokens_neox': 700, 'n_words': 224}