Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.d.ts 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. declare namespace callsites {
  2. interface CallSite {
  3. /**
  4. Returns the value of `this`.
  5. */
  6. getThis(): unknown | undefined;
  7. /**
  8. Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property.
  9. */
  10. getTypeName(): string | null;
  11. /**
  12. Returns the current function.
  13. */
  14. getFunction(): Function | undefined;
  15. /**
  16. Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
  17. */
  18. getFunctionName(): string | null;
  19. /**
  20. Returns the name of the property of `this` or one of its prototypes that holds the current function.
  21. */
  22. getMethodName(): string | undefined;
  23. /**
  24. Returns the name of the script if this function was defined in a script.
  25. */
  26. getFileName(): string | null;
  27. /**
  28. Returns the current line number if this function was defined in a script.
  29. */
  30. getLineNumber(): number | null;
  31. /**
  32. Returns the current column number if this function was defined in a script.
  33. */
  34. getColumnNumber(): number | null;
  35. /**
  36. Returns a string representing the location where `eval` was called if this function was created using a call to `eval`.
  37. */
  38. getEvalOrigin(): string | undefined;
  39. /**
  40. Returns `true` if this is a top-level invocation, that is, if it's a global object.
  41. */
  42. isToplevel(): boolean;
  43. /**
  44. Returns `true` if this call takes place in code defined by a call to `eval`.
  45. */
  46. isEval(): boolean;
  47. /**
  48. Returns `true` if this call is in native V8 code.
  49. */
  50. isNative(): boolean;
  51. /**
  52. Returns `true` if this is a constructor call.
  53. */
  54. isConstructor(): boolean;
  55. }
  56. }
  57. declare const callsites: {
  58. /**
  59. Get callsites from the V8 stack trace API.
  60. @returns An array of `CallSite` objects.
  61. @example
  62. ```
  63. import callsites = require('callsites');
  64. function unicorn() {
  65. console.log(callsites()[0].getFileName());
  66. //=> '/Users/sindresorhus/dev/callsites/test.js'
  67. }
  68. unicorn();
  69. ```
  70. */
  71. (): callsites.CallSite[];
  72. // TODO: Remove this for the next major release, refactor the whole definition to:
  73. // declare function callsites(): callsites.CallSite[];
  74. // export = callsites;
  75. default: typeof callsites;
  76. };
  77. export = callsites;