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

Upgrade typescript to 4.4 #10827

Merged
merged 1 commit into from
Nov 8, 2021
Merged
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
Expand Up @@ -86,8 +86,8 @@ async function getStorageData () {
}

function clearStorageData () {
return new Promise(resolve => {
chrome.storage.local.remove(STORAGE_KEY, resolve)
return new Promise<void>(resolve => {
chrome.storage.local.remove(STORAGE_KEY, () => resolve())
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Clock extends React.PureComponent<Props, ClockState> {

get dateTimeFormat (): any {
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
const options = { hour: 'numeric', minute: 'numeric' }
const options: Intl.DateTimeFormatOptions = { hour: 'numeric', minute: 'numeric' }
if (this.props.clockFormat === '24') {
options['hourCycle'] = 'h23'
} else if (this.props.clockFormat === '12') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const createWidget = <P extends object>(WrappedComponent: React.ComponentType<P>
widgetMenuPersist={widgetMenuPersist}
textDirection={textDirection}
menuPosition={menuPosition}
hideWidget={hideWidget as HideWidgetFunction}
hideWidget={hideWidget}
persistWidget={this.persistWidget}
unpersistWidget={this.unpersistWidget}
lightWidget={lightWidget}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ export default class WalletWrapper extends React.PureComponent<Props, State> {
return
}

// tslint:disable
const isWindows = window.navigator.platform === 'Win32'

return (
<GrantWrapper
isPanel={true}
Expand All @@ -251,7 +254,7 @@ export default class WalletWrapper extends React.PureComponent<Props, State> {
onSolution={this.onSolution.bind(this, grant.promotionId)}
captchaImage={grant.captchaImage}
hint={grant.hint}
isWindows={window.navigator.platform === 'Win32'}
isWindows={isWindows}
/>
</GrantWrapper>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TopTabNavButton } from '../'

export interface Props {
tabList: TopTabNavObjectType[]
selectedTab: TopTabNavTypes | AddAccountNavTypes | AccountSettingsNavTypes
selectedTab?: TopTabNavTypes | AddAccountNavTypes | AccountSettingsNavTypes
onSubmit: (id: TopTabNavTypes | AddAccountNavTypes | AccountSettingsNavTypes) => void
onLockWallet?: () => void
hasMoreButtons?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
} from '../../popup-modals/add-account-modal/hardware-wallet-connect/types'

interface ParamsType {
category: TopTabNavTypes
id: string
category?: TopTabNavTypes
id?: string
}

export interface Props {
Expand Down Expand Up @@ -146,7 +146,7 @@ const CryptoView = (props: Props) => {
React.useEffect(() => {
if (category === 'portfolio') {
if (id !== undefined) {
const asset = userVisibleTokensInfo.find((token) => token.symbol.toLowerCase() === id.toLowerCase())
const asset = userVisibleTokensInfo.find((token) => token.symbol.toLowerCase() === id?.toLowerCase())
onSelectAsset(asset)
setHideNav(true)
} else {
Expand All @@ -159,7 +159,7 @@ const CryptoView = (props: Props) => {
if (id === 'add-account') {
onShowAddModal()
} else {
const account = accounts.find((a) => a.address.toLowerCase() === id.toLowerCase())
const account = accounts.find((a) => a.address.toLowerCase() === id?.toLowerCase())
setSelectedAccount(account)
setHideNav(true)
}
Expand Down
6 changes: 4 additions & 2 deletions components/brave_wallet_ui/page/reducers/page_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ reducer.on(Actions.doneViewingPrivateKey, (state: PageState) => {
})

reducer.on(Actions.walletSetupComplete, (state: PageState) => {
const newState = { ...state }
const newState: PageState = {
...state,
setupStillInProgress: false
}
delete newState.mnemonic
delete newState.setupStillInProgress
return newState
})

Expand Down
5 changes: 3 additions & 2 deletions components/definitions/rewards.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ declare namespace Rewards {
export enum RewardsType {
AUTO_CONTRIBUTE = 2,
ONE_TIME_TIP = 8,
RECURRING_TIP = 21
RECURRING_TIP = 16
}

export interface ContributionSaved {
Expand Down Expand Up @@ -289,7 +289,8 @@ declare namespace Rewards {
CONNECTED = 1,
VERIFIED = 2,
DISCONNECTED_NOT_VERIFIED = 3,
DISCONNECTED_VERIFIED = 4
DISCONNECTED_VERIFIED = 4,
PENDING = 5
}

export interface ExternalWallet {
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@
"tslint-config-standard": "7.1.0",
"tslint-react": "3.6.0",
"typesafe-actions": "2.2.0",
"typescript": "3.9.9",
"typescript-plugin-styled-components": "1.4.4",
"typescript": "4.4.4",
"typescript-plugin-styled-components": "2.0.0",
"url-loader": "0.6.2",
"webpack": "4.46.0",
"webpack-cli": "3.3.12"
Expand Down