Skip to content

decorator error message is very confusing #3569

@asukaminato0721

Description

@asukaminato0721

Describe the Bug

Argument (self: Self@ExternalApiTemplateListApi) -> tuple[dict[str, bool | int | list[ExternalKnowledgeApiDict] | None], int] is not assignable to parameter view with type (@_, str, ParamSpec(@_)) -> @_ in function controllers.console.wraps.with_current_tenant_id

all I need to do is

def get(self): ...

to

def get(self, current_tenant_id: str): ...

so the error message should tell me I missing a str parameter at definition.

maybe the definition also can help a bit.

def with_current_tenant_id[T, **P, R](
    view: Callable[Concatenate[T, str, P], R],
) -> Callable[Concatenate[T, P], R]:
    @wraps(view)
    def decorated(self: T, *args: P.args, **kwargs: P.kwargs) -> R:
        _, current_tenant_id = current_account_with_tenant()
        return view(self, current_tenant_id, *args, **kwargs)
    return decorated

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-serverIssues specific to our IDE integration rather than type checkingreadability

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions