# Function timeout

- timeout<T>(ms, promise, message?): Promise<T>

- Returns a promise that will be fulfilled with the given promise's fulfillment value or rejection reason. However, if the promise is not resolved within `ms` milliseconds, the returned promise is rejected with an error.

  #### Type Parameters

  - T

  #### Parameters

  - ms: number

    The number of milliseconds to wait for the promise to resolve.

  - promise: Promise<T>

    The promise to wait for.

  - `Optional` message: string | Error

    The message or error to throw if the promise times out.

  #### Returns Promise<T>