Skip to content

Commit

Permalink
fix typescript configs in the 4337-passkeys app
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Jun 25, 2024
1 parent 105c00f commit 87b998a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 40 deletions.
5 changes: 1 addition & 4 deletions examples/4337-passkeys/src/hooks/useCodeAtAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ function useCodeAtAddress(provider: ethers.Eip1193Provider, address: string, opt
const pollInterval = opts?.pollInterval || 5000

updateBalance()
// We convert the interval to a number because typescript thinks this call is ambiguous
// since node.js and browser have different return types for setInterval
// more info: https://github.com/Microsoft/TypeScript/issues/30128#issuecomment-807394387
const interval = +setInterval(updateBalance, pollInterval)
const interval = setInterval(updateBalance, pollInterval)

return () => {
cancelled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ function useEntryPointAccountBalance(

fetchBalance()

// We convert the interval to a number because typescript thinks this call is ambiguous
// since node.js and browser have different return types for setInterval
// more info: https://github.com/Microsoft/TypeScript/issues/30128#issuecomment-807394387
const interval = +setInterval(fetchBalance, opts.pollInterval)
const interval = setInterval(fetchBalance, opts.pollInterval)
return () => {
cancelled = true
clearInterval(interval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ function useEntryPointAccountNonce(

fetchNonce()

// We convert the interval to a number because typescript thinks this call is ambiguous
// since node.js and browser have different return types for setInterval
// more info: https://github.com/Microsoft/TypeScript/issues/30128#issuecomment-807394387
const interval = +setInterval(fetchNonce, opts.pollInterval)
const interval = setInterval(fetchNonce, opts.pollInterval)
return () => {
cancelled = true
clearInterval(interval)
Expand Down
5 changes: 1 addition & 4 deletions examples/4337-passkeys/src/hooks/useNativeTokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ function useNativeTokenBalance(provider: ethers.Eip1193Provider, address: string
const pollInterval = opts?.pollInterval || 5000

updateBalance()
// We convert the interval to a number because typescript thinks this call is ambiguous
// since node.js and browser have different return types for setInterval
// more info: https://github.com/Microsoft/TypeScript/issues/30128#issuecomment-807394387
const interval = +setInterval(updateBalance, pollInterval)
const interval = setInterval(updateBalance, pollInterval)

return () => {
cancelled = true
Expand Down
27 changes: 27 additions & 0 deletions examples/4337-passkeys/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
32 changes: 9 additions & 23 deletions examples/4337-passkeys/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}
5 changes: 4 additions & 1 deletion examples/4337-passkeys/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
},
"include": ["vite.config.ts"]
}

0 comments on commit 87b998a

Please sign in to comment.