Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove any from return types #317

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useInjectedConnector } from '../useConnectors';
import useDefaultWallets from '../../wallets/useDefaultWallets';
import { WalletProps } from '../../wallets/wallet';
import Logos from '../../assets/logos';

export const useInjectedWallet = () => {
Expand Down Expand Up @@ -38,18 +39,19 @@ export const useInjectedWallet = () => {
};

const getWallet = () => {
const installedWallets = wallets.filter((wallet: any) => wallet.installed);
const installedWallets = wallets.filter((wallet) => wallet.installed);
if (installedWallets.length > 0) {
return installedWallets[0];
} else {
return {
const wallet: WalletProps = {
id: 'injected',
name: getInjectedNames()?.[0] ?? 'Browser Wallet',
shortName: getInjectedNames()?.[0]?.replace(' Wallet', '') ?? 'Browser',
logos: {
default: <Logos.Injected />,
},
};
}
return wallet;
}
};

Expand Down
10 changes: 4 additions & 6 deletions packages/connectkit/src/siwe/useSIWE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ type HookProps = {
isSignedIn: boolean;
data?: SIWESession;
status: StatusState;
error?: Error | any;
error?: Error;
isRejected: boolean;
isError: boolean;
isLoading: boolean;
isSuccess: boolean;
isReady: boolean;

reset: () => void;
signIn: () => Promise<boolean>;
signOut: () => Promise<boolean>;
signIn: () => Promise<void>;
signOut: () => Promise<void>;
};

type UseSIWEConfig = {
Expand All @@ -23,9 +23,7 @@ type UseSIWEConfig = {
};

// Consumer-facing hook
export const useSIWE = ({ onSignIn, onSignOut }: UseSIWEConfig = {}):
| HookProps
| any => {
export const useSIWE = ({ onSignIn, onSignOut }: UseSIWEConfig = {}): HookProps => {
const siweContextValue = useContext(SIWEContext);
if (!siweContextValue) {
// If we throw an error here then this will break non-SIWE apps, so best to just respond with not signed in.
Expand Down
2 changes: 1 addition & 1 deletion packages/connectkit/src/wallets/useDefaultWallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { WalletProps } from './wallet';

import { useConnect } from 'wagmi';

function useDefaultWallets(): WalletProps[] | any {
function useDefaultWallets(): WalletProps[] {
const { connectors } = useConnect();

let defaultWallets: string[] = [];
Expand Down
Loading