Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. declare const pTry: {
  2. /**
  3. Start a promise chain.
  4. @param fn - The function to run to start the promise chain.
  5. @param arguments - Arguments to pass to `fn`.
  6. @returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
  7. @example
  8. ```
  9. import pTry = require('p-try');
  10. (async () => {
  11. try {
  12. const value = await pTry(() => {
  13. return synchronousFunctionThatMightThrow();
  14. });
  15. console.log(value);
  16. } catch (error) {
  17. console.error(error);
  18. }
  19. })();
  20. ```
  21. */
  22. <ValueType, ArgumentsType extends unknown[]>(
  23. fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
  24. ...arguments: ArgumentsType
  25. ): Promise<ValueType>;
  26. // TODO: remove this in the next major version, refactor the whole definition to:
  27. // declare function pTry<ValueType, ArgumentsType extends unknown[]>(
  28. // fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
  29. // ...arguments: ArgumentsType
  30. // ): Promise<ValueType>;
  31. // export = pTry;
  32. default: typeof pTry;
  33. };
  34. export = pTry;