accounts icon indicating copy to clipboard operation
accounts copied to clipboard

`CustomUser` TypeScript generic type variable not propagated throughout codebase

Open KeithGillette opened this issue 2 years ago • 1 comments

Bug report

Describe the bug

AccountsServer and AccountsPassword are generic classes allowing a CustomUser type variable to be passed, presumably to allow for typing extensions to the AccountsJS User type. However, User instead of CustomUser is referenced in many other locations in the code (for example, EmailTemplateType and all Mongo methods), leading to errors when attempting to access custom properties on extended User implementations.

Expected behavior

A type variable passed to AccountsServer and AccountsPassword would be respected on their implementation methods.

System information

    "@accounts/apollo-link": "0.32.1",
    "@accounts/client": "0.33.1",
    "@accounts/graphql-api": "0.33.2",
    "@accounts/graphql-client": "0.33.1",
    "@accounts/magic-link": "0.1.1",
    "@accounts/mongo": "0.34.0",
    "@accounts/mongo-password": "0.32.4",
    "@accounts/password": "0.32.1",
    "@accounts/server": "0.33.1",

Additional context

I suppose this could be considered a feature request but it just looks like generics are only partially implemented, so I'm submitting it as a bug.

KeithGillette avatar Jun 16 '22 19:06 KeithGillette

Same here. If we can extend interfaces (User), then we should also be able to pass generics to all those classes.

danyhiol avatar Sep 14 '22 10:09 danyhiol