diff --git a/understand-anything-plugin/packages/core/src/__tests__/language-lesson.test.ts b/understand-anything-plugin/packages/core/src/__tests__/language-lesson.test.ts index 19ebb0bc..5c1b5c46 100644 --- a/understand-anything-plugin/packages/core/src/__tests__/language-lesson.test.ts +++ b/understand-anything-plugin/packages/core/src/__tests__/language-lesson.test.ts @@ -140,6 +140,20 @@ describe("language-lesson", () => { expect(concepts).toContain("middleware pattern"); }); + it("does not flag type guards from the 'is' substring in common words", () => { + const plainNode: GraphNode = { + id: "function:math:add", + type: "function", + name: "add", + filePath: "src/math/add.ts", + summary: "This function adds two numbers", + tags: ["utility"], + complexity: "simple", + }; + const concepts = detectLanguageConcepts(plainNode, "typescript"); + expect(concepts).not.toContain("type guards"); + }); + it("returns empty for nodes with no detectable concepts", () => { const plainNode: GraphNode = { id: "file:src/config.ts", diff --git a/understand-anything-plugin/packages/core/src/analyzer/language-lesson.ts b/understand-anything-plugin/packages/core/src/analyzer/language-lesson.ts index 53fcc01a..cab4d4df 100644 --- a/understand-anything-plugin/packages/core/src/analyzer/language-lesson.ts +++ b/understand-anything-plugin/packages/core/src/analyzer/language-lesson.ts @@ -24,7 +24,7 @@ const BASE_CONCEPT_PATTERNS: Record = { "listener", ], "singleton": ["singleton", "instance", "shared client"], - "type guards": ["type guard", "is", "narrowing", "discriminated union"], + "type guards": ["type guard", "narrowing", "discriminated union"], "higher-order functions": [ "callback", "factory",