forked from abner/for-legacy-web
remove most uses of as any in typescript
- replaced many uses of `as any` with another more specific cast `as T` - filled in missing typed for items that needed to be typed - new runtime code was added where necessary to satisfy the new types with comments - added missing theme variable "sidebar-active" to the Theme variables - forms using `react-hook-form` are now typechecked - changed some instances of `target` into `currentTarget` while removing `as any` assertions
This commit is contained in:
@@ -384,7 +384,7 @@ export default function AutoComplete({ detached, state, setState, onClick }: Pic
|
||||
})
|
||||
}
|
||||
onClick={onClick}>
|
||||
<Emoji emoji={(emojiDictionary as any)[match]} size={20} />
|
||||
<Emoji emoji={(emojiDictionary as Record<string, string>)[match]} size={20} />
|
||||
:{match}:
|
||||
</button>
|
||||
))}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ComboBox from "../ui/ComboBox";
|
||||
import { connectState } from "../../redux/connector";
|
||||
import { WithDispatcher } from "../../redux/reducers";
|
||||
import { LanguageEntry, Languages } from "../../context/Locale";
|
||||
import { Language, LanguageEntry, Languages } from "../../context/Locale";
|
||||
|
||||
type Props = WithDispatcher & {
|
||||
locale: string;
|
||||
@@ -15,12 +15,12 @@ export function LocaleSelector(props: Props) {
|
||||
props.dispatcher &&
|
||||
props.dispatcher({
|
||||
type: "SET_LOCALE",
|
||||
locale: e.currentTarget.value as any
|
||||
locale: e.currentTarget.value as Language
|
||||
})
|
||||
}
|
||||
>
|
||||
{Object.keys(Languages).map(x => {
|
||||
const l = (Languages as any)[x] as LanguageEntry;
|
||||
const l = Languages[x as keyof typeof Languages];
|
||||
return (
|
||||
<option value={x}>
|
||||
{l.emoji} {l.display}
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function UpdateIndicator() {
|
||||
return internalSubscribe('PWA', 'update', () => setPending(true));
|
||||
});
|
||||
|
||||
if (!pending) return;
|
||||
if (!pending) return <></>;
|
||||
const theme = useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,7 +35,12 @@ function Message({ attachContext, message, contrast, content: replacement, head:
|
||||
const content = message.content as string;
|
||||
const head = preferHead || (message.replies && message.replies.length > 0);
|
||||
|
||||
const userContext = attachContext ? attachContextMenu('Menu', { user: message.author, contextualChannel: message.channel }) : undefined as any; // ! FIXME: tell fatal to make this type generic
|
||||
// ! FIXME: tell fatal to make this type generic
|
||||
// bree: Fatal please...
|
||||
const userContext = attachContext
|
||||
? attachContextMenu('Menu', { user: message.author, contextualChannel: message.channel }) as any
|
||||
: undefined;
|
||||
|
||||
const openProfile = () => openScreen({ id: 'profile', user_id: message.author });
|
||||
|
||||
return (
|
||||
|
||||
@@ -18,7 +18,8 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||
const open_url = `${url}/${filename}`;
|
||||
const download_url = url.replace('attachments', 'attachments/download')
|
||||
|
||||
const filesize = determineFileSize(size as any);
|
||||
// for some reason revolt.js says the size is a string even though it's a number
|
||||
const filesize = determineFileSize(size as unknown as number);
|
||||
|
||||
switch (metadata.type) {
|
||||
case 'Image':
|
||||
|
||||
Reference in New Issue
Block a user