index.d.ts 727 B

1234567891011121314151617181920212223242526272829
  1. declare const resolveGlobal: {
  2. /**
  3. Resolve the path of a globally installed module.
  4. @param moduleId - What you would use in `require()`.
  5. @returns The resolved path. Throws if the module can't be found.
  6. @example
  7. ```
  8. // $ npm install --global cat-names
  9. import resolveGlobal = require('resolve-global');
  10. console.log(resolveGlobal('cat-names'));
  11. //=> '/usr/local/lib/node_modules/cat-names'
  12. ```
  13. */
  14. (moduleId: string): string;
  15. /**
  16. Resolve the path of a globally installed module.
  17. @param moduleId - What you would use in `require()`.
  18. @returns The resolved path. Returns `undefined` instead of throwing if the module can't be found.
  19. */
  20. silent(moduleId: string): string | undefined;
  21. };
  22. export = resolveGlobal;