Commit f5557a43 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

chore: upgrade type system (#2276)

* chore: upgrade type system

Upgrade types, typescript, and formatters.

* fix: ListsState tests
parent 5dfe44da
......@@ -76,7 +76,7 @@ export function useSearchInactiveTokenLists(search: string | undefined, minResul
if (!list) continue
for (const tokenInfo of list.tokens) {
if (tokenInfo.chainId === chainId && tokenFilter(tokenInfo)) {
const wrapped = new WrappedTokenInfo(tokenInfo, list)
const wrapped: WrappedTokenInfo = new WrappedTokenInfo(tokenInfo, list)
if (!(wrapped.address in activeTokens) && !addressSet[wrapped.address]) {
addressSet[wrapped.address] = true
result.push(wrapped)
......
......@@ -47,10 +47,12 @@ const initialState: ListsState = {
export default createReducer(initialState, (builder) =>
builder
.addCase(fetchTokenList.pending, (state, { payload: { requestId, url } }) => {
const current = state.byUrl[url]?.current ?? null
const pendingUpdate = state.byUrl[url]?.pendingUpdate ?? null
state.byUrl[url] = {
current: null,
pendingUpdate: null,
...state.byUrl[url],
current: current,
pendingUpdate: pendingUpdate,
loadingRequestId: requestId,
error: null,
}
......@@ -66,11 +68,10 @@ export default createReducer(initialState, (builder) =>
if (upgradeType === VersionUpgrade.NONE) return
if (loadingRequestId === null || loadingRequestId === requestId) {
state.byUrl[url] = {
...state.byUrl[url],
loadingRequestId: null,
error: null,
current: current,
pendingUpdate: tokenList,
loadingRequestId: null,
error: null,
}
}
} else {
......@@ -80,11 +81,10 @@ export default createReducer(initialState, (builder) =>
}
state.byUrl[url] = {
...state.byUrl[url],
loadingRequestId: null,
error: null,
current: tokenList,
pendingUpdate: null,
loadingRequestId: null,
error: null,
}
}
})
......@@ -95,11 +95,10 @@ export default createReducer(initialState, (builder) =>
}
state.byUrl[url] = {
...state.byUrl[url],
loadingRequestId: null,
error: errorMessage,
current: null,
pendingUpdate: null,
loadingRequestId: null,
error: errorMessage,
}
})
.addCase(addList, (state, { payload: url }) => {
......@@ -140,8 +139,8 @@ export default createReducer(initialState, (builder) =>
}
state.byUrl[url] = {
...state.byUrl[url],
pendingUpdate: null,
current: state.byUrl[url].pendingUpdate,
pendingUpdate: null,
}
})
.addCase(updateVersion, (state) => {
......
......@@ -16,6 +16,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useUnknownInCatchVariables": false,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment