Open dearlordylord opened 3 months ago
In mine and some other codebases, immutability goes by default.
The adapter doesn't like it, so the type like const wallets: readonly [PhantomWalletAdapter, SolflareWalletAdapter] won't work:
const wallets: readonly [PhantomWalletAdapter, SolflareWalletAdapter]
const useWallets = () => { const phantomWallet = new PhantomWalletAdapter(); const solflareWallet = new SolflareWalletAdapter(); return useMemo(() => [phantomWallet, solflareWallet] as const, [phantomWallet, solflareWallet]); } ... const wallets = useWallets(); <WalletProvider wallets={wallets}/>
I have to either cast or re-construct <WalletProvider wallets={[...wallets]}/>, which is undesirable.
<WalletProvider wallets={[...wallets]}/>
This PR allows readonly arrays as wallets prop, as well as keeps mutable arrays backwards-compatible.
readonly
wallets
In mine and some other codebases, immutability goes by default.
The adapter doesn't like it, so the type like
const wallets: readonly [PhantomWalletAdapter, SolflareWalletAdapter]
won't work:I have to either cast or re-construct
<WalletProvider wallets={[...wallets]}/>
, which is undesirable.This PR allows
readonly
arrays aswallets
prop, as well as keeps mutable arrays backwards-compatible.