昂卢阿尔管道问题(地图)



im正在尝试了解平均堆栈,我遇到了此代码的问题。

它在编译时给出了这个错误,如果你对如何解决这个问题有想法,将不胜感激

getPosts() {
this.http
.get<{ message: string; posts:any }>(
"http://localhost:3000/api/posts"
)
.pipe(map((postData) => {
return postData.posts.map(post => {
return {
title: post.title,
content: post.content,
id: post._id
};
});
}))
.subscribe(transformedPosts => {
this.posts = transformedPosts;
this.postsUpdated.next([...this.posts]);
});
}

错误:src/app/posts/posts.service.ts:20:13-错误TS2345:"import"类型的参数("C:\Windows/System32/metric server/node_modules/rxjs/dist/types/internal/types"(。OperatorFunction<{message:string;posts:any;},any>'不能分配给'import("C:\Windows/System32/node_modules/rxjs/dist/types/internal/types"(类型的参数。OperatorFunction<{message:string;posts:any;},any>'。

get<{ message: string; posts:any[] }>

最新更新