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

table组件中的Column项中的fixed是string或boolean类型,但是现在只规定了boolean类型,ts中使用报错 #25658

Closed
1 task
944832260 opened this issue Jul 16, 2020 · 16 comments
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@944832260
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://ant.design/components/table-cn/#API

Steps to reproduce

11

What is expected?

修复

What is actually happening?

11

Environment Info
antd 4.4.2
React 16.13.1
System win
Browser 谷歌
@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label Jul 16, 2020
@ant-design-bot
Copy link
Contributor

Hello @944832260. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

你好 @944832260, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。7 天内未跟进的 issue 将会被自动关闭。

@07akioni
Copy link
Contributor

https://github.com/react-component/table/blob/master/src/interface.ts#L22

It seems that the string type exists in rc-table

@944832260
Copy link
Author

944832260 commented Jul 16, 2020

https://github.com/react-component/table/blob/master/src/interface.ts#L22

似乎字符串类型存在于rc-table中

咱们别似乎行吗 ?我是 不知道咋贴图,能贴图的话早就贴了

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 16, 2020

直接粘贴,拖拽到输入框都可以

@944832260
Copy link
Author

直接粘贴

http://chuantu.xyz/t6/739/1594882431x-1404755402.jpg
上传到网络上了,看图片报错吧

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 16, 2020

比较模糊,电脑上直接截图,粘贴会清晰一些。

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 16, 2020

image

看上去是可以的

@944832260
Copy link
Author

image

看上去是可以的

image

@944832260
Copy link
Author

image

看上去是可以的

image

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 16, 2020

用复现发代码吧,这样效率太低

@07akioni
Copy link
Contributor

https://github.com/react-component/table/blob/master/src/interface.ts#L22
似乎字符串类型存在于rc-table中

咱们别似乎行吗 ?我是 不知道咋贴图,能贴图的话早就贴了

发这个是为了辅助之后看这个 issue 的人判断。

@944832260
Copy link
Author

用复现发代码吧,这样效率太低

https://github.com/944832260/webpack4-react-ts/blob/master/src/pages/warehousing/warehousing.tsx
仓库拉代码看项目吧

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 16, 2020

image

能提供在线的最好,还能改代码。

@Xing-He
Copy link

Xing-He commented Jul 21, 2020

Same error, need fix !!!

const column = [
    {
         .....,
         fixed: 'right'
    }
]

<Table column={column} datasource={[....]}/>

@kerm1it
Copy link
Member

kerm1it commented Jul 21, 2020

这个应该是由于没有给 state 写类型声明导致的,TS进行类型推导时把 fixed 推导成了 string 类型

试试这个:
https://codesandbox.io/s/infallible-chaplygin-vjp81?file=/src/App.tsx

@944832260
Copy link
Author

Same error, need fix !!!

const column = [
    {
         .....,
         fixed: 'right'
    }
]

<Table column={column} datasource={[....]}/>

现在的fiexd只能设置true或者false,string类型不行的

这个应该是由于没有给 state 写类型声明导致的,TS进行类型推导时把 fixed 推导成了 string 类型

试试这个:
https://codesandbox.io/s/infallible-chaplygin-vjp81?file=/src/App.tsx

这个可以 3Q

@afc163 afc163 closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests

7 participants