index.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. declare module 'pretty-error' {
  2. namespace PrettyError {
  3. function start(): any;
  4. function stop(): any;
  5. class ParsedError {
  6. constructor( error:Error );
  7. }
  8. interface ConfigObject {
  9. skipPackages?:boolean | string[],
  10. skipPaths?:boolean | string[],
  11. skip?:boolean | PrettyError.Callback | PrettyError.Callback[],
  12. maxItems?:number,
  13. skipNodeFiles?:boolean | any // assuming this is optional
  14. filters?:boolean | PrettyError.Callback | PrettyError.Callback[],
  15. parsedErrorFilters?:boolean | PrettyError.Callback | PrettyError.Callback[],
  16. aliases?:boolean | Object
  17. }
  18. interface Callback {
  19. traceLine:Object | any,
  20. lineNumber:number
  21. }
  22. }
  23. class PrettyError {
  24. constructor();
  25. start():PrettyError;
  26. stop():any;
  27. config( configObject:PrettyError.ConfigObject ):PrettyError;
  28. withoutColors():PrettyError;
  29. withColors():PrettyError;
  30. skipPackage( ... packages:string[] ):PrettyError;
  31. unskipPackage( ... packages:string[] ):PrettyError;
  32. unskipAllPackages():PrettyError;
  33. skipPath( ... paths:string[] ):PrettyError;
  34. unskipPath( ... paths:string[] ):PrettyError;
  35. unskipAllPaths():PrettyError;
  36. skip( callbacks:PrettyError.Callback ):PrettyError;
  37. unskip( callbacks:PrettyError.Callback ):PrettyError;
  38. unskipAll():PrettyError;
  39. skipNodeFiles():any;
  40. unskipNodeFiles():any;
  41. filter( callbacks:PrettyError.Callback ):PrettyError;
  42. removeFilter( callbacks:PrettyError.Callback ):PrettyError;
  43. removeAllFilters():PrettyError;
  44. filterParsedError( callbacks:PrettyError.Callback ):PrettyError;
  45. removeParsedErrorFilter( callbacks:PrettyError.Callback ):PrettyError;
  46. removeAllParsedErrorFilters():PrettyError;
  47. setMaxItems( maxItems:number ):PrettyError;
  48. alias( stringOrRx:string, alias:string ):PrettyError;
  49. removeAlias( stringOrRx:string ):PrettyError;
  50. removeAllAliases():PrettyError;
  51. appendStyle( toAppend:Object ):PrettyError;
  52. render( e:PrettyError.ParsedError, logIt?:boolean, useColors?:boolean ):string;
  53. getObject( e:Object ):Object;
  54. }
  55. export = PrettyError;
  56. }