Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FieldValueを型安全にする #28

Open
yarnaimo opened this issue Apr 15, 2021 · 1 comment
Open

FieldValueを型安全にする #28

yarnaimo opened this issue Apr 15, 2021 · 1 comment
Assignees

Comments

@yarnaimo
Copy link
Owner

No description provided.

@yarnaimo yarnaimo self-assigned this Apr 15, 2021
@mojamozya
Copy link

firestoreを導入してみようと試みているなか、大変便利そうなライブラリを発見して感激しております。

ところで、私のほうで採用してみたところ、以下のような現象が起きています。

const dbUserSchema = z.object({
  name: z.string(),
  bio: z.string(),
});

上記のようなスキーマを持つドキュメントに対して、

userRef.create({ name: 'a', bio: 'a' });

というようなcreateやupdateをしようとすると、エディタ上の解析で

(property) bio: Timestamp | FieldValue
型 'string' を型 'Timestamp | FieldValue' に割り当てることはできません。

というようなエラーが出てしまうのと本issueは関係がありますでしょうか?
情報が不足しておりましたら大変申し訳ありません。

念の為、使用しているnpmパッケージのバージョンも記しておきます。

"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"fireschema": "^5.0.0-36",
"firebase": "^9.17.2",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants