解构接口

时间:2016-10-18 02:57:23

标签: generics reactjs typescript jsx typescript2.0

我在这里有点困惑,为什么这不起作用。有人可以解释为什么PriceComponent中的plans并不意味着从定义的界面进行输入。

import * as React from 'react';
import Plans from '../data/Plans';

interface PricingProps {
  plans: {
    [index: number]: {
      id: number,
      unitLimit: string,
      ownerLimit: string,
      storageLimit: string,
    };
  };
}

const Pricing: React.StatelessComponent<any> = () => <PricingComponent plans={Plans} />;

const PricingComponent: React.StatelessComponent<PricingProps> = ({ plans }) =>
  <div />;

0 个答案:

没有答案