mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
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:
@@ -107,11 +107,8 @@ function HomeSidebar(props: Props) {
|
||||
)}
|
||||
<Localizer>
|
||||
<Category
|
||||
text={
|
||||
(
|
||||
<Text id="app.main.categories.conversations" />
|
||||
) as any
|
||||
}
|
||||
text={<Text id="app.main.categories.conversations" />}
|
||||
/** @ts-ignore : ignored due to conflicting naming between the Category property name and the existing JSX attribute */
|
||||
action={() => openScreen({ id: "special_input", type: "create_group" })}
|
||||
/>
|
||||
</Localizer>
|
||||
|
||||
@@ -55,12 +55,8 @@ export function GroupMemberSidebar({ channel, ctx }: Props & { channel: Channels
|
||||
|
||||
members.sort((a, b) => {
|
||||
// ! FIXME: should probably rewrite all this code
|
||||
let l = ((a.online &&
|
||||
a.status?.presence !== Users.Presence.Invisible) ??
|
||||
false) as any | 0;
|
||||
let r = ((b.online &&
|
||||
b.status?.presence !== Users.Presence.Invisible) ??
|
||||
false) as any | 0;
|
||||
let l = +((a.online && a.status?.presence !== Users.Presence.Invisible) ?? false) | 0;
|
||||
let r = +((b.online && b.status?.presence !== Users.Presence.Invisible) ?? false) | 0;
|
||||
|
||||
let n = r - l;
|
||||
if (n !== 0) {
|
||||
@@ -159,12 +155,8 @@ export function ServerMemberSidebar({ channel, ctx }: Props & { channel: Channel
|
||||
// copy paste from above
|
||||
users.sort((a, b) => {
|
||||
// ! FIXME: should probably rewrite all this code
|
||||
let l = ((a.online &&
|
||||
a.status?.presence !== Users.Presence.Invisible) ??
|
||||
false) as any | 0;
|
||||
let r = ((b.online &&
|
||||
b.status?.presence !== Users.Presence.Invisible) ??
|
||||
false) as any | 0;
|
||||
let l = +((a.online && a.status?.presence !== Users.Presence.Invisible) ?? false) | 0;
|
||||
let r = +((b.online && b.status?.presence !== Users.Presence.Invisible) ?? false) | 0;
|
||||
|
||||
let n = r - l;
|
||||
if (n !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user