小编dig*_*fee的帖子

属性不存在于类型 'IntrinsicAttributes & IntrinsicClassAttributes<DatePicker> & Readonly<{ children?: ReactNode; }> ...'

我正在尝试将 React 与 TypeScript 和 Material-UI 的组件一起使用。不幸的是,我收到了这样的错误:

属性 'openToYearSelection' 不存在于类型 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> ...'。

import * as React from 'react';
import DatePicker from 'material-ui/DatePicker';

interface IState {
  birthday: any,
}

export default class SampleForm extends React.Component<IProps, IState> {
  constructor(props: any) {
    super(props);

    const { record = {} } = this.props;

    this.state = {
      birthday: record.birthday || null,
    };
  }

  public birthdayPicker() {
    const { birthday } = this.state;

    return (
      <DatePicker
        defaultDate={birthday}
        hintText="Birthday"
        openToYearSelection={true}
      /> …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs material-ui

6
推荐指数
1
解决办法
2万
查看次数

使用node.js从Firestore中的子集合中删除文档

我想从Firebase子集合中删除一个文档。我正在尝试通过以下方式做到这一点:

firestore.collection('categories').doc(categoryId).collection('books').doc(bookId).delete();
Run Code Online (Sandbox Code Playgroud)

而且它不起作用。

但是,我可以从集合中删除文档:

firestore.collection('categories').doc(categoryId).delete();
Run Code Online (Sandbox Code Playgroud)

我会看不见东西吗?应该如何运作?

更新:

const firebase = require('../firebase/firebaseAdmin');
const firestore = firebase.firestore();

module.exports = {
  removeBookFromCategory: (categoryId, bookId) => (
    firestore
      .collection('categories')
      .doc(categoryId)
      .collection('books')
      .doc(bookId)
      .delete()
  ),
};
Run Code Online (Sandbox Code Playgroud)

我在这里有正确的ID,但出现500错误:

错误:参数“ documentPath”不是有效的ResourcePath。路径必须是非空字符串。

node.js firebase google-cloud-firestore

5
推荐指数
1
解决办法
2303
查看次数