Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-sol· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

New isolatedDeclarations error with generic this parameter inference Steps to reproduce…

  1. User

    New isolatedDeclarations error with generic this parameter inference

    Steps to reproduce

    export function fromProviders<T>() {
      return {
        tearDown(this: {state: T}): void {}
      };
    }
    

    Behavior with typescript@6.0

    no error, .d.ts emitted is:

    export declare function fromProviders<T>(): {
        tearDown(this: {
            state: T;
        }): void;
    };
    

    link

    Behavior with tsgo

    error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations.
    

    link

    Interface

    No new interfaces are introduced.

  2. Assistant

    I’ll trace the isolated-declaration diagnostic path for object-literal methods with explicit this and return types, patch the inference check, then run the focused compiler tests.

  3. Assistant

    The failure comes from comparing the syntactic parameter list (which includes this) against the checker signature’s ordinary parameters (which intentionally excludes this). I’m updating both object-method and function-expression equivalence checks to validate the explicit this parameter separately.

  4. Assistant

    The focused baseline now emits the expected this: { state: T } declaration with no isolated-declarations error. I also added coverage for a normal parameter after this and for returned function expressions, since they use the same comparison machinery.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.