From af49b4f9ecb7cb9442d6ba85ad37317ae87ed8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fernando=20H=C3=B6wer=20Barbosa?= Date: Wed, 7 Dec 2022 10:21:05 +0100 Subject: [PATCH] Fix bug that identify wrongly some TS packages as Definetely Typed (#1091) * Reverse logic to fix bug with types not recognized * Remove empty line to match codebase style --- src/typescript/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/typescript/index.ts b/src/typescript/index.ts index 3d5fb87f3..18822cd50 100644 --- a/src/typescript/index.ts +++ b/src/typescript/index.ts @@ -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) { @@ -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 } };