microsoft / microsoft/TypeScript

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

Aperta
#62,183 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Domain: check: Error Instability Help Wanted Needs Human Review
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

### 🔎 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

```ts
///

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

//// export interface Pipeable {
//// pipe(this: A, ab: (_: A) => B): B;
//// }
////
//// type Covariant = (_: never) => A;
////
//// interface VarianceStruct {
//// readonly _V: string;
//// readonly _A: Covariant
;
//// readonly _E: Covariant;
//// readonly _R: Covariant;
//// }
////
//// declare const EffectTypeId: unique symbol;
////
//// interface Variance {
//// readonly [EffectTypeId]: VarianceStruct;
//// }
////
//// interface Effect
//// extends Variance,
//// Pipeable {}
////
//// interface Class extends Pipeable {
//// new (): Fields;
//// }
////
//// interface TaggedErrorClass extends Class {
//// 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
//// ) => Effect;
////
//// export const categoriesKey = "@effect/error/categories";
////
//// export declare const withCategory: >(
//// ...categories: Categories
//// ) => , Ret, C extends { new (...args: Args): Ret }>(
//// C: C
//// ) => C & {
//// new (...args: Args): Ret & {
//// [categoriesKey]: { [Cat in Categories[number]]: true };
//// };
//// };
////
//// export type AllKeys = E extends { [categoriesKey]: infer Q }
//// ? keyof Q
//// : never;
//// export type ExtractAll = Cats extends any
//// ? Extract
//// : never;
////
//// export declare const catchCategory: <
//// E,
//// const Categories extends Array>,
//// A2,
//// E2,
//// R2
//// >(
//// ...args: [
//// ...Categories,
//// f: (err: ExtractAll) => Effect
//// ]
//// ) => (
//// effect: Effect
//// ) => Effect
>, 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;
////
//// 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_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il test inline fourslash.ts e riproduci la sequenza di edit, signature-help, backspace e diagnostic nell’esempio Playground. Segui il signature-help retrigger path per la chiamata rest-parameter inferita. Il lavoro è completato quando il codice invariato non produce alcun semantic diagnostic dopo la rimozione della virgola, mentre signature help rimane visibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.