test: createScanAction.test.ts の vi.fn() typing を統一 (#238)#251
Merged
Conversation
`src/stores/createScanAction.test.ts` の 6 箇所の generic 未指定 `vi.fn()` を、既に統一されている `vi.fn<(label: string) => Promise<string[]>>()` または `vi.fn<() => Promise<string[]>>()` 形式に揃える。 修正対象: - L33, L148, L181: `(label: string) => Promise<string[]>` (引数あり) - L51, L202, L219: `() => Promise<string[]>` (引数なし) 実害なし、test の typing 一貫性のみ。8 ケース全 pass + typecheck clean。
This was referenced Jun 28, 2026
ymnao
added a commit
that referenced
this pull request
Jun 28, 2026
…t> 型として export (#255) (#256) `CreateScanActionOptions.api` field の inline thunked signature `() => (...args: TArgs) => Promise<TResult>` を named type alias `ScanApi<TArgs extends unknown[], TResult>` として切り出し export。 - 型の意図 (thunk 経由で実 API 関数を返す理由) を docstring 付きで明示 - 将来 scan 系 helper を増やした際の参照点を確保 - caller (`src/stores/backlink.ts` / `src/stores/wikilink.ts`) と test (`createScanAction.test.ts`) は generic 推論で互換、変更不要 Option A (最小変更、createScanAction.ts のみ) を採用。Option B (caller サイトでも `ScanApi` 注釈を強制) は `createScanAction<...>` の generic で既に型推論が機能するため冗長で skip。 PR #251 (createScanAction.test.ts の vi.fn() typing 統一) の /simplify pass 2 副産物として発見。 Refs #255
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
src/stores/createScanAction.test.tsの 6 箇所の generic 未指定vi.fn()を、既に統一されているvi.fn<(label: string) => Promise<string[]>>()またはvi.fn<() => Promise<string[]>>()形式に揃える typing 統一。実害なし、test の typing 一貫性のみ。関連 Issue
closes #238
移行 Stage
(該当 stage なし — test infrastructure 整備)
変更内容
src/stores/createScanAction.test.tsの 6 箇所 (L33, L51, L148, L181, L202, L219) のvi.fn()(generic 未指定) をvi.fn<Signature>()形式に統一<(label: string) => Promise<string[]>>(引数あり、createScanAction<TestState, [string], string[]>対応)<() => Promise<string[]>>(引数なし、createScanAction<TestState, [], string[]>対応)動作確認
vitest run src/stores/createScanAction.test.tsで 8 ケース全 passtsc --noEmit3 config clean (tsconfig.node.json / tsconfig.web.json / tsconfig.e2e.json)biome check src/stores/createScanAction.test.tscleangrep "vi\.fn()" src/stores/createScanAction.test.tsで hit 0 (統一済)/code-review medium(8 angles) clean/simplify2 回実行 (pre/post-commit): 採用 0 件スクリーンショット
(UI 変更なし)
補足
/simplifypost-commit で次セッション候補として記録した altitude 指摘:src/stores/createScanAction.ts:15の inline 型(...args: TArgs) => Promise<TResult>をexport type ScanApi<TArgs, TResult>として alias 化 → test と production contract の named 参照統一が可能。本 PR は scope 拡大で見送り、別 issue 候補として残置