Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

docs: fix nullable return types in generated typedoc#2102

Open
spotlight21c wants to merge 1 commit intoredis:mainredis/ioredis:mainfrom
spotlight21c:fix/typedoc-nullable-typespotlight21c/ioredis:fix/typedoc-nullable-typeCopy head branch name to clipboard
Open

docs: fix nullable return types in generated typedoc#2102
spotlight21c wants to merge 1 commit intoredis:mainredis/ioredis:mainfrom
spotlight21c:fix/typedoc-nullable-typespotlight21c/ioredis:fix/typedoc-nullable-typeCopy head branch name to clipboard

Conversation

@spotlight21c
Copy link
Copy Markdown

@spotlight21c spotlight21c commented Apr 17, 2026

Summary

The generated TypeDoc documentation strips | null from every command that can return null. For example, redis.get() is rendered as Promise<string> even though its declared signature is Promise<string | null>. The same issue affects 70+ commands across Redis, Cluster, and ChainableCommander (e.g. get, getex, getdel, mget, hmget, zscore, zrank, bzpopmin, blpop, lpop, spop, geopos, ...).

Root cause

strictNullChecks is off in tsconfig.json. With it disabled, TypeScript treats null as assignable to every type, so string | null collapses to string during type resolution. TypeDoc reads the collapsed type from the compiler and renders it as Promise<string>.

Fix

Generate docs with strictNullChecks enabled, without affecting the main build:

  1. Add tsconfig.docs.json that extends tsconfig.json and sets strictNullChecks: true.
  2. Update the docs script to pass --tsconfig ./tsconfig.docs.json and --skipErrorChecking (existing source has pre-existing strictNullChecks violations that are unrelated to docs generation).
  3. Bump typedoc from ^0.22.18 to ^0.25.13. 0.25 is the newest TypeDoc line that still supports TypeScript 4.6.x, and it's the minimum version providing --skipErrorChecking.

No runtime code, build output, or public type declarations are changed.

Before / after

redis.get(key) signature in docs/classes/Redis.html:

  • Before: get(key, callback?): Promise<string>
  • After: get(key, callback?): Promise<null | string>

The same correction applies to all nullable-return commands


Note

Medium Risk
Medium risk because it upgrades typedoc and its dependency chain and changes the docs build to use a separate tsconfig, which may impact contributors/CI environments (notably Node version requirements) but does not affect runtime code.

Overview
Fixes TypeDoc output for nullable return types by generating docs with a dedicated tsconfig.docs.json that enables strictNullChecks.

Updates the docs script to use that tsconfig and --skipErrorChecking, and bumps typedoc to ^0.25.13 (with corresponding lockfile dependency updates such as shiki/marked/minimatch).

Reviewed by Cursor Bugbot for commit 2104c1e. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented Apr 17, 2026

Hi, I鈥檓 Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you鈥檒l enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@PavelPashov
Copy link
Copy Markdown
Contributor

@spotlight21c thanks, I'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.