位置“位置”类型中缺少以下属性:mongodb 中的祖先起源、哈希、主机、主机名等

问题描述 投票:0回答:2

我试图创建一个像

mongodb document
一样的

当我将鼠标悬停在

IUserModel
上时,它给出了这样的错误

Location“Location”类型中缺少以下属性:ancestorOrigins、hash、host、hostname 以及其他 9 个属性。

mongodb document reserved-words
2个回答
4
投票

很久以后我才知道

location
mongodb

的保留关键字

所以我将

location
更改为
locatedOn
并且错误消失了:)


0
投票

我有一个简单的 .ts 文件:

interface Location {
    name: string;
    id: number;
}

const location1: Location = {
    name: 'oakland',
    id: 1,
};

错误提示:

输入 '{ 名称:字符串;身份证号; }' 缺少以下内容 “位置”类型的属性:ancestorOrigins、哈希值、主机、 主机名,还有 9 个。

根据我的发现,我认为它来自于: https://developer.mozilla.org/en-US/docs/Web/API/Location

我不明白为什么当我只使用 typescript 时会给我一个 HTML DOM api 错误。

© www.soinside.com 2019 - 2024. All rights reserved.