accounts
accounts copied to clipboard
`CustomUser` TypeScript generic type variable not propagated throughout codebase
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.
Same here. If we can extend interfaces (User
), then we should also be able to pass generics to all those classes.