refactor(types): drop remaining as-any / ts-ignore in cross-cutting infra (#1989) - #2048
Merged
Conversation
…nfra (#1989) Closes the last weak-typing items from the #1989 audit: - redis-client.ts: replace 3x `Record<string, any>` (+ their deno-lint-ignore directives) with a local `RedisClientFactoryOptions` interface describing the subset of @redis/client createClient options we actually pass (url, socket.tls, password, username). - security/sandbox/project-worker.ts: drop the `@ts-ignore` on `new Worker(...)` by making `ExtendedWorkerOptions` an intersection with the DOM `WorkerOptions` (matching deno-sandbox.ts), so the value is assignable to the constructor without suppressing the whole line. Pure type-level changes; no runtime behavior change. project-worker tests still pass (Worker is constructed at runtime). Refs #1989
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.
What
Closes the last weak-typing items from the
#1989audit (findings #2 weak typing + #6@ts-ignorecluster). Pure type-level cleanup — no runtime behavior change.Changes
src/utils/redis-client.ts— replace 3×Record<string, any>(and theirdeno-lint-ignore no-explicit-anydirectives) with a localRedisClientFactoryOptionsinterface describing the subset of@redis/client'screateClientoptions we actually pass (url,socket.tls,password,username). The npm module is loaded via dynamicimport()and is otherwiseany, so the typed boundary lives on our side.src/security/sandbox/project-worker.ts— drop the@ts-ignoreonnew Worker(...)by makingExtendedWorkerOptionsan intersection with the DOMWorkerOptions(WorkerOptions & { deno?: { permissions } }), matching the pattern already used indeno-sandbox.ts. The value is now assignable to theWorkerconstructor without suppressing the whole line (Deno still reads the extradenofield at runtime).Tests
Pure type changes — the typecheck is the gate. Existing
project-worker.test.tsstill passes (it constructs a real Worker), confirming the suppression removal is runtime-safe. No adjacent redis-client test exists; the runtimecreateClientcall is unchanged.Refs #1989