'firebase/auth'
声明用户界面具有
readonly
道具。当您将该接口强制应用于状态对象时,TS信任您。
把它摊开,应该可以去除
只读
从它的道具,同时仍然推断出类型:
export const useUserStore = defineStore('user', {
state: () => ({ ...({
displayName: null,
email: null,
emailVerified: null,
isAnonymous: null,
metadata: null,
multiFactor: null,
phoneNumber: null,
photoURL: null,
providerData: null,
providerId: null,
refreshToken: null,
tenantId: null,
uid: null,
} as unknown as User) }),
actions: {
//...
}
})