添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
有腹肌的啄木鸟  ·  使用 JdbcTemplate ...·  2 周前    · 
爱跑步的钥匙  ·  MybatisPlus学习笔记 | ...·  2 周前    · 
咆哮的馒头  ·  Get Nth Entry from ...·  2 周前    · 
留胡子的汤圆  ·  SharePoint 搜索 REST ...·  1 周前    · 
没有腹肌的开水瓶  ·  Exception in thread ...·  1 周前    · 
腼腆的火柴  ·  REST API Beispiel PHP ...·  3 月前    · 
干练的西装  ·  Solved: ...·  4 月前    · 
满身肌肉的水桶  ·  Using PyQt5 with ...·  7 月前    · 

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 Table components align Type 'string' is not assignable to type '"right" | "left" | "center" | undefined'. #27668 Table components align Type 'string' is not assignable to type '"right" | "left" | "center" | undefined'. #27668 codedart2018 opened this issue Nov 10, 2020 · 1 comment
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • Reproduction link

    Steps to reproduce

    const columns = [
          title: '排行',
          dataIndex: 'goods_id',
          width: '15%',
          align: 'center',
          render: (val, record, index) => {
            index  = 1;
            let className = '';
            switch (index) {
              case 1:
                className = 'first';
                break;
              case 2:
                className = 'second';
                break;
              case 3:
                className = 'third';
            return (<span className={className}>{index}</span>);
          title: '商品名称',
          dataIndex: 'goods_name',
          width: '70%'
          title: '销量',
          dataIndex: 'sales',
          width: '15%',
          align: 'center',
          render: (val, record, index) => {
            index  = 1;
            let className = '';
            switch (index) {
              case 1:
                className = 'first';
                break;
              case 2:
                className = 'second';
                break;
              case 3:
                className = 'third';
            return (<span className={className}>{val}</span>);
      const data = [
          goods_id: 1,
          goods_name: '陕西眉县徐香绿心猕猴桃',
          sales: 108
          goods_id: 2,
          goods_name: '山东沾化冬枣 精品果',
          sales: 99
          goods_id: 3,
          goods_name: '四川当季爱媛38号果冻橙 可以吸的新鲜水果',
          sales: 71
    

    What is expected?

    typescript 不警告报错

    What is actually happening?

      Type '{ title: string; dataIndex: string; width: string; align: string; render: (val: any, record: any, index: any) => Element; } | { title: string; dataIndex: string; width: string; align?: undefined; render?: undefined; }' is not assignable to type 'ColumnGroupType<{ goods_id: number; goods_name: string; sales: number; }> | ColumnType<{ goods_id: number; goods_name: string; sales: number; }>'.
        Type '{ title: string; dataIndex: string; width: string; align: string; render: (val: any, record: any, index: any) => Element; }' is not assignable to type 'ColumnGroupType<{ goods_id: number; goods_name: string; sales: number; }> | ColumnType<{ goods_id: number; goods_name: string; sales: number; }>'.
          Type '{ title: string; dataIndex: string; width: string; align: string; render: (val: any, record: any, index: any) => Element; }' is not assignable to type 'ColumnType<{ goods_id: number; goods_name: string; sales: number; }>'.
            Types of property 'align' are incompatible.
              Type 'string' is not assignable to type '"left" | "center" | "right" | undefined'.
    

    如果对cloumns 强制 any 又背离了初衷。JS版本不会报,ts版本会报!演示地址是js版本。跟我本地代码一致的!

    Environment help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Nov 10, 2020 help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Nov 10, 2020