Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into 2440/uni-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro committed Mar 16, 2022
2 parents b9fbd92 + c01d30a commit fb2e468
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ import flatMap from 'array.prototype.flatmap'

flat.shim()
flatMap.shim()

const originalConsole = window.console
// define a new console
const proxiedConsole = new Proxy(window.console, {
get(obj, prop: keyof Console) {
if (process.env.NODE_ENV !== 'production') {
return obj[prop]
} else {
return () => undefined
}
},
})

window.console = Object.assign({}, proxiedConsole, { force: originalConsole })
console = window.console
5 changes: 5 additions & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare module '@metamask/jazzicon' {
declare module 'fortmatic'

interface Window {
console: Console & { force: Console }
// walletLinkExtension is injected by the Coinbase Wallet extension
walletLinkExtension?: any
ethereum?: {
Expand All @@ -20,6 +21,10 @@ interface Window {
web3?: Record<string, unknown>
}

interface Console extends Node.Console {
force: Node.Console
}

declare module 'content-hash' {
declare function decode(x: string): string
declare function getCodec(x: string): string
Expand Down

0 comments on commit fb2e468

Please sign in to comment.