index.d.ts 467 B

1234567891011121314151617
  1. /**
  2. Let a globally installed package use a locally installed version of itself if available.
  3. @param filePath - The absolute file path to the main file of the package.
  4. @example
  5. ```
  6. import importLocal from 'import-local';
  7. if (importLocal(import.meta.url)) {
  8. console.log('Using local version of this package');
  9. } else {
  10. // Code for both global and local version here…
  11. }
  12. ```
  13. */
  14. export default function importLocal(filePath: string): boolean | undefined | unknown;