我试过了:
@Post()
async create(@Body() body: CreateStreamDto): Promise<typeof Stream> {
return { id: '12', connectionUrl: 'stuff' }
}但上面写着:
ype '{ id: string; connectionUrl: string; }' is not assignable to type 'typeof Stream'.
Object literal may only specify known properties, and 'id' does not exist in type 'typeof Stream'.发布于 2020-05-28 01:37:42
如果你要返回一个模型的实例,你应该只需要Promise<Stream>。typeof Stream可能会返回Object或类似的内容,这就是为什么会出现上面的错误。
https://stackoverflow.com/questions/62048965
复制相似问题