Skip to content

New isolatedDeclarations error with generic this parameter inference #4057

@blickly

Description

@blickly

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

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions