stack.d.ts 933 B

12345678910111213141516171819202122232425262728
  1. import { ErrorLike } from "./types";
  2. /**
  3. * The Property Descriptor of a lazily-computed `stack` property.
  4. */
  5. interface LazyStack {
  6. configurable: true;
  7. /**
  8. * Lazily computes the error's stack trace.
  9. */
  10. get(): string | undefined;
  11. }
  12. /**
  13. * Is the property lazily computed?
  14. */
  15. export declare function isLazyStack(stackProp: PropertyDescriptor | undefined): stackProp is LazyStack;
  16. /**
  17. * Is the stack property writable?
  18. */
  19. export declare function isWritableStack(stackProp: PropertyDescriptor | undefined): boolean;
  20. /**
  21. * Appends the original `Error.stack` property to the new Error's stack.
  22. */
  23. export declare function joinStacks(newError: ErrorLike, originalError?: ErrorLike): string | undefined;
  24. /**
  25. * Calls `joinStacks` lazily, when the `Error.stack` property is accessed.
  26. */
  27. export declare function lazyJoinStacks(lazyStack: LazyStack, newError: ErrorLike, originalError?: ErrorLike): void;
  28. export {};