Apply lint rule @typescript-eslint/no-empty-object-type (#29159)

* Apply lint rule @typescript-eslint/no-empty-object-type

To avoid the footgun that is https://www.totaltypescript.com/the-empty-object-type-in-typescript

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-02-04 13:41:34 +00:00
committed by GitHub
parent 8cae1e9f5e
commit 7eb969bbc2
56 changed files with 157 additions and 158 deletions

View File

@@ -11,10 +11,10 @@ import { AccountDataEvents, ClientEvent, MatrixClient, MatrixEvent } from "matri
import { useTypedEventEmitter } from "./useEventEmitter";
const tryGetContent = <T extends {}>(ev?: MatrixEvent): T | undefined => ev?.getContent<T>();
const tryGetContent = <T extends object>(ev?: MatrixEvent): T | undefined => ev?.getContent<T>();
// Hook to simplify listening to Matrix account data
export const useAccountData = <T extends {}>(cli: MatrixClient, eventType: keyof AccountDataEvents): T => {
export const useAccountData = <T extends object>(cli: MatrixClient, eventType: keyof AccountDataEvents): T => {
const [value, setValue] = useState<T | undefined>(() => tryGetContent<T>(cli.getAccountData(eventType)));
const handler = useCallback(