Просмотр исходного кода

fix(suggest-path): resolve TypeScript build errors in CI

- Fix TS2352 in route handler: add intermediate `unknown` cast for
  SearchService to Record<string, unknown> type assertion
- Fix TS2322 in integration test: use ContentAnalysis type instead of
  typeof stockAnalysis so flow/stock variants are both accepted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VANELLOPE\tomoyuki-t 1 месяц назад
Родитель
Сommit
c40ae758e0

+ 2 - 1
apps/app/src/features/suggest-path/server/integration-tests/suggest-path-integration.spec.ts

@@ -2,6 +2,7 @@ import type { NextFunction, Request, Response } from 'express';
 import express from 'express';
 import request from 'supertest';
 
+import type { ContentAnalysis } from '~/features/suggest-path/interfaces/suggest-path-types';
 import type Crowi from '~/server/crowi';
 import type { ApiV3Response } from '~/server/routes/apiv3/interfaces/apiv3-response';
 
@@ -345,7 +346,7 @@ describe('POST /suggest-path integration', () => {
 
     // Helper: set up full pipeline success with optional overrides
     const setupFullPipeline = (overrides?: {
-      analysis?: typeof stockAnalysis;
+      analysis?: ContentAnalysis;
       candidates?: typeof searchCandidates;
       evaluated?: typeof singleEvaluated;
       category?: typeof categorySuggestionFixture | null;

+ 2 - 2
apps/app/src/features/suggest-path/server/routes/apiv3/index.ts

@@ -71,8 +71,8 @@ export const suggestPathHandlersFactory = (crowi: Crowi): RequestHandler[] => {
         const { searchService } = crowi;
         assert(
           searchService != null &&
-            typeof (searchService as Record<string, unknown>).searchKeyword ===
-              'function',
+            typeof (searchService as unknown as Record<string, unknown>)
+              .searchKeyword === 'function',
           'searchService must have searchKeyword method',
         );
         const typedSearchService = searchService as unknown as SearchService;