我在 loopback 4 框架中收到错误。如何解决这个错误?
I am getting the error in loopback 4 framework. How to solve this error?
(方法)MyUserService.convertToUserProfile(用户:用户):UserProfile
将 verifyCredentials() 返回的用户转换为描述应用程序中用户的通用用户配置文件
Property 'convertToUserProfile' in type 'MyUserService' is not assignable to the same property in base type 'UserService<User, Credentials>'.
Type '(user: import("d:/lb4/lllog/test/src/models/user.model").User) => import("d:/lb4/lllog/test/node_modules/@loopback/authentication/dist/types").UserProfile' is not assignable to type '(user: import("d:/lb4/lllog/test/src/models/user.model").User) => import("d:/lb4/lllog/test/node_modules/@loopback/security/dist/types").UserProfile'.
Property '[securityId]' is missing in type 'import("d:/lb4/lllog/test/node_modules/@loopback/authentication/dist/types").UserProfile' but required in type 'import("d:/lb4/lllog/test/node_modules/@loopback/security/dist/types").UserProfile'.ts(2416)
types.d.ts(12, 5): '[securityId]' is declared here.
Peek Problem
No quick fixes available
你能试试这样的东西吗?
convertToUserProfile(user: User): UserProfile {
return {
id: user.id,
name: '<' + user.email + '>' + user.name,
[securityId]: user.id,
};
}
我遇到了同样的问题,解决方案是从环回安全性中导入 securityId。
从“@loopback/security”导入{securityId, UserProfile};
(方法)MyUserService.convertToUserProfile(用户:用户):UserProfile 将 verifyCredentials() 返回的用户转换为描述应用程序中用户的通用用户配置文件
Property 'convertToUserProfile' in type 'MyUserService' is not assignable to the same property in base type 'UserService<User, Credentials>'.
Type '(user: import("d:/lb4/lllog/test/src/models/user.model").User) => import("d:/lb4/lllog/test/node_modules/@loopback/authentication/dist/types").UserProfile' is not assignable to type '(user: import("d:/lb4/lllog/test/src/models/user.model").User) => import("d:/lb4/lllog/test/node_modules/@loopback/security/dist/types").UserProfile'.
Property '[securityId]' is missing in type 'import("d:/lb4/lllog/test/node_modules/@loopback/authentication/dist/types").UserProfile' but required in type 'import("d:/lb4/lllog/test/node_modules/@loopback/security/dist/types").UserProfile'.ts(2416)
types.d.ts(12, 5): '[securityId]' is declared here.
Peek Problem
No quick fixes available
你能试试这样的东西吗?
convertToUserProfile(user: User): UserProfile {
return {
id: user.id,
name: '<' + user.email + '>' + user.name,
[securityId]: user.id,
};
}
我遇到了同样的问题,解决方案是从环回安全性中导入 securityId。
从“@loopback/security”导入{securityId, UserProfile};