Skip to content

Commit

Permalink
Fix bug that identify wrongly some TS packages as Definetely Typed (#…
Browse files Browse the repository at this point in the history
…1091)

* Reverse logic to fix bug with types not recognized

* Remove empty line to match codebase style
  • Loading branch information
Josehower committed Dec 7, 2022
1 parent d99c31f commit af49b4f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/typescript/index.ts
Expand Up @@ -66,6 +66,16 @@ export function getTypeScriptSupport(
return { types: pkg.types };
}

for (const file of filelist) {
if (!file.name.endsWith('.d.ts')) {
continue;
}

datadog.increment('jsdelivr.getTSSupport.hit');

return { types: { ts: 'included' } };
}

// The 2nd most likely is definitely typed
const defTyped = isDefinitelyTyped({ name: pkg.name });
if (defTyped) {
Expand All @@ -76,16 +86,6 @@ export function getTypeScriptSupport(
},
};
}

for (const file of filelist) {
if (!file.name.endsWith('.d.ts')) {
continue;
}

datadog.increment('jsdelivr.getTSSupport.hit');

return { types: { ts: 'included' } };
}
datadog.increment('jsdelivr.getTSSupport.miss');

return { types: { ts: false } };
Expand Down

0 comments on commit af49b4f

Please sign in to comment.