fix(no-floating-promises): avoid recursive checker calls#977
Draft
camc314 wants to merge 1 commit into
Draft
Conversation
eea92ec to
ed033d2
Compare
a7eff35 to
22df9f9
Compare
ed033d2 to
4d71eb8
Compare
22df9f9 to
4ec1443
Compare
Base automatically changed from
codex/no-floating-promises-spread-handler
to
main
May 19, 2026 11:15
4ec1443 to
44d3ec7
Compare
44d3ec7 to
3c6aec7
Compare
|
Hit this exact failure mode from a real-world library, not just a synthetic test case — wanted to add it as a data point since it shows the recursive-type pattern this PR guards against does occur in published Upgrading import { float } from "three/tsl";
import type Node from "three/src/nodes/core/Node.js";
const x = float(1.0);
export async function check() {
await Promise.resolve(x).then((val: Node) => {
console.log(val);
});
}
Versions: Happy to share the full repro repo if useful — currently it's a 4-file project ( |
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.
Stacked on #976.
This re-enables the recursive
CustomNodeno-floating-promises cases. The rule now avoids full argument-sensitive call resolution only when the callee return signatures are already enough to prove the expression cannot produce a promise or promise array.The guard deliberately does not fire for return types that still need call-site instantiation, including type variables, conditional types, indexed access types, substitution types, unions/intersections containing them, or array/tuple element types containing them. That keeps generic array-returning cases such as
.map(...)and generic conditional promise returns on the normal checker path.This follows the failure mode from typescript-eslint/typescript-eslint#12294 without adding a panic/recover wrapper or matching the regression test shape directly.
Validation:
UPDATE_SNAPS=true go test ./internal/rules/no_floating_promises/... -timeout=60sgo test ./internal/rules/no_floating_promises/... -timeout=60s