Skip to content

⬅️ Back to Table of Contents

📄 index.test.ts

📊 Analysis Summary

Metric Count
🔧 Functions 2
📦 Imports 6
⚡ Async/Await Patterns 2

📚 Table of Contents

🛠️ File Location:

📂 packages/core/useAsyncState/index.test.ts

📦 Imports

Name Source
promiseTimeout @vueuse/shared
describe vitest
expect vitest
it vitest
vi vitest
useAsyncState ./index

Async/Await Patterns

Type Function Await Expressions Promise Chains
promise-chain p1 none new Promise(...)
async-function p2 none none

Functions

p1(num: number): Promise<unknown>

Code
(num = 1) => {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve(num)
      }, 50)
    })
  }
  • Parameters:
  • num: number
  • Return Type: Promise<unknown>
  • Calls:
  • setTimeout
  • resolve

p2(id: string): Promise<string>

Code
async (id?: string) => {
    if (!id)
      throw new Error('error')
    return id
  }
  • Parameters:
  • id: string
  • Return Type: Promise<string>