Microsoft/TypeScript

Ghost error appearing after signature help in inferred signatures with rest parameter

Open

#62,183 建立於 2025年8月3日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: check: Error InstabilityHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

🔎 Search Terms

signature help inference signature rest spread nested

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=6.0.0-dev.20250803#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgBQTGEwCMAbPAbwCg44wjgAeAQQBo4AhOAXjiTAAbmgB8AChgALBAGcAXHA5wyi8QH1FrAJR9R3bYq4BuGgF8aNGAE9icAMIQhmKAkwo2+-hsWCRUXV59VlMaZFQMHDwANRc3JFwAZRgoAFdsGGYIVPhlbPgAUU58uAAlfVp6KBIAEwgkcms4dWjFWRTkAHNTKtr6xubWRUdnV3dM1lEeuGrMOoam9QLhpzjx5gKpuhm+hebSldH4zPLTCxoa4GxyFzxseva4AvR0K5gAFVtgAEkaxVSkAgAI6pPCyawAW1IEHIoXCaCwuDgsTGCRYJTyOSexSx5TglR2c36TQA2s9XhlPsRfgBdRQo+JJFLpCacIplLbneGRJHkt5ZLGYwp8ATCNA4+ClEV+MTbUCoJA1WTItZothszjldjbeiEYhkSj4rkoBFRBw3WSyZgAMQQwHISv08uAiuVepIFGo20EAHc4OJDHBbfalWdLNzEXh3phOp1gDUClAoNB7BardHOnBna64O1XEhOpxgw7ZE6QAqlebMJabXaSxVtrN5gN1DAY4oM2GLlcbtU4PckI8M3GE0noGoEJcUAh0HaoAB+NodAuBfTMbYZrPll2VvNdbX0YtKmgSbZtzodmMHuCzkOyADyUEUR9kNFXcGH8cTyagqerVo3K9tgJXoiT2Vt2w-GNpgsLZu2uW5+weeByAgC9-W2AA6bCIWAS0Y2ARRSl2RpWCTTBrGYdxrFEN89CeF5+SECBJ04GUoDYsUoDg0BIFgJDB3gbBMFQTpoDtWQAGlgCafgACIAAFgEYjIAHo0B-VThNE8S8Lk0JeOgeBLgQvsB0eH0EGkewROAMSoGsRRmBsnTXDwrcK2VMioAo5h8GTYhYGsaSaNPehsMw7S7N0hQHFs+yJLooI4DYKBOmVbNK283zqNETVgBgTh7A8ndlSoUU-XECKXHSrQ0tkQNiPgMwwocYYkv0YqADJ8W9YBKuq+q6vSxqCrgHqQLgEkooSvCQrpfEppcxAkDi1yJJJJBUihNAaQW5k8DMGCzgM8AjLgGw7FYchyBCq1NhFAoSpzcrpvimL5sUZBXigOAAEU4Aseh5zgABrGSIHQf7tl8LjTEM-jLrwApyx8jJrvIDYipEjLtxzfyIECmwQq8Nbcc8lQkGsbYQZRlIcEydlXpmj6ZIW17JJWsmFuowHAdo+hYf8U6+OMntEPMoSROwKQXOihynO2Iptkltb5Yk56svIyiMbujZRDy7ZWAAJmvApTe2UpjZPcQsOwmrYpJHU4AiuXZtka96HQNQNMUOm0ZgDGsbV93Nu20hdtEd8+QyNhTaeeOrYFuAaQ6lLlHKW36GUikYD9lTWWxDk05jiY4AAHyUePzYrp4QGuVJLmD-2GaD9k3ZisOdqgGkDc1Wuk9CBDLSDCAIG-aBNeVT9Rx-ANxDk60x4nqA5M4KgzG0TDGGILO4Es6z3oche6ghTBkDk7Q6I3yxh+VLgXBXqeoNjL8xygee5IfqAV7Xo0t53sAPeB9ZZH2sAvcE7RgAQj-nJU+58kCX2vucO+3BMAAC8n6ZWnjGEcK9P4P0we-P+G8AFMGAVZUBrlwFyUgagGBV9dA33gr2O4yE4CkAwWobYIBfDhzQCXAuzB2JFmXu-Wu38n6V0ISvTi-geJnX4qrMAyZOg+QhCKTh6DxAAEYyG720jLDux84EQDPhfTgGh3yoU6BoTCEFOjaCcaESwri3FAA

💻 Code

/// <reference path="fourslash.ts" />

// @strict: true
// @target: esnext
// @lib: esnext

//// export interface Pipeable {
////   pipe<A, B = never>(this: A, ab: (_: A) => B): B;
//// }
////
//// type Covariant<A> = (_: never) => A;
////
//// interface VarianceStruct<out A, out E, out R> {
////   readonly _V: string;
////   readonly _A: Covariant<A>;
////   readonly _E: Covariant<E>;
////   readonly _R: Covariant<R>;
//// }
////
//// declare const EffectTypeId: unique symbol;
////
//// interface Variance<out A, out E, out R> {
////   readonly [EffectTypeId]: VarianceStruct<A, E, R>;
//// }
////
//// interface Effect<out A, out E = never, out R = never>
////   extends Variance<A, E, R>,
////     Pipeable {}
////
//// interface Class<Fields> extends Pipeable {
////   new (): Fields;
//// }
////
//// interface TaggedErrorClass<Tag extends string, Fields> extends Class<Fields> {
////   readonly _tag: Tag;
//// }
////
//// declare const TaggedError: (identifier?: string) => <
////   Tag extends string,
////   Fields
//// >(
////   tag: Tag,
////   fieldsOr: Fields
//// ) => TaggedErrorClass<
////   Tag,
////   {
////     readonly _tag: Tag;
////   }
//// >;
////
//// declare const log: (
////   ...message: ReadonlyArray<any>
//// ) => Effect<void, never, never>;
////
//// export const categoriesKey = "@effect/error/categories";
////
//// export declare const withCategory: <Categories extends Array<PropertyKey>>(
////   ...categories: Categories
//// ) => <Args extends Array<any>, Ret, C extends { new (...args: Args): Ret }>(
////   C: C
//// ) => C & {
////   new (...args: Args): Ret & {
////     [categoriesKey]: { [Cat in Categories[number]]: true };
////   };
//// };
////
//// export type AllKeys<E> = E extends { [categoriesKey]: infer Q }
////   ? keyof Q
////   : never;
//// export type ExtractAll<E, Cats extends PropertyKey> = Cats extends any
////   ? Extract<E, { [categoriesKey]: { [K in Cats]: any } }>
////   : never;
////
//// export declare const catchCategory: <
////   E,
////   const Categories extends Array<AllKeys<E>>,
////   A2,
////   E2,
////   R2
//// >(
////   ...args: [
////     ...Categories,
////     f: (err: ExtractAll<E, Categories[number]>) => Effect<A2, E2, R2>
////   ]
//// ) => <A, R>(
////   effect: Effect<A, E, R>
//// ) => Effect<A | A2, E2 | Exclude<E, ExtractAll<E, Categories[number]>>, R | R2>;
////
//// class FooError extends TaggedError()("FooError", {}).pipe(
////   withCategory("domain")
//// ) {}
////
//// class BarError extends TaggedError()("BarError", {}).pipe(
////   withCategory("system", "domain")
//// ) {}
////
//// class BazError extends TaggedError()("BazError", {}).pipe(
////   withCategory("system")
//// ) {}
////
//// declare const baz: (
////   x: number
//// ) => Effect<never, FooError | BarError | BazError, never>;
////
//// export const program = baz(1).pipe(catchCategory("domain",/*1*/ (_) => log(_._tag)));

verify.getSemanticDiagnostics([]);
goTo.marker("1");
edit.insert(",");
verify.signatureHelpPresentForTriggerReason({
    kind: "characterTyped",
    triggerCharacter: ",",
});
edit.backspace(1);
verify.signatureHelpPresentForTriggerReason({
    kind: "retrigger",
});
verify.getSemanticDiagnostics([]);

🙁 Actual behavior

It's sometimes a little bit tricky to reproduce it in the playground but steps are pretty easy:

  1. position ur cursor after "domain", in the last statement
  2. insert ,
  3. this should trigger the signature help
  4. now remove the inserted comma character
  5. the signature help should still be visible at this point
  6. error is reported

🙂 Expected behavior

Given the code is exactly the same at the step 6 as it is before any steps are taken, I don't expect this code to report any errors. Any edit outside of the catchCategory's argument list makes the error go away (a further indication the error should not be there) but edits inside that argument list don't make it go away.

Additional information about the issue

No response

貢獻者指南