From d5cf3479614a8b8ec1bde51d43a4d553aab25e80 Mon Sep 17 00:00:00 2001 From: Mark Edwards Date: Fri, 31 Jul 2026 09:00:19 +0000 Subject: [PATCH] fix: type the CommonJS export with `export =` `index.js` is CommonJS (`module.exports = fn`), but `index.d.ts` typed it as an ES `export default` alongside an empty `declare module 'robots-parser';`. The empty ambient declaration types the whole module as `any`, so the `Robot` interface is never actually applied. And `export default` does not describe `module.exports = fn` under `moduleResolution: node16`/`nodenext`. Replace both with `export = robotsParser`, matching the runtime. No code changes. Since the module currently resolves to `any`, this only adds accurate types and breaks nothing that type-checks today. --- index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 0cf4313..8d02a2d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,3 @@ -declare module 'robots-parser'; - interface Robot { isAllowed(url: string, ua?: string): boolean | undefined; isDisallowed(url: string, ua?: string): boolean | undefined; @@ -10,4 +8,6 @@ interface Robot { getPreferredHost(): string | null; } -export default function robotsParser(url: string, robotstxt: string): Robot; +declare function robotsParser(url: string, robotstxt: string): Robot; + +export = robotsParser;