Git Product home page Git Product logo

Comments (21)

afc163 avatar afc163 commented on July 1, 2024

现在 React.Key 里有个 bigint,难受。

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

现在 React.Key 里有个 bigint,难受。

我升级类型文件之后,看着报红,又决定回退版本了

from ant-design.

afc163 avatar afc163 commented on July 1, 2024

具体问题反馈一下,提供一个重现?这样比较好下手。

from ant-design.

github-actions avatar github-actions commented on July 1, 2024

Hello @guaijie. Please provide a online reproduction by forking codesandbox of [email protected] or [email protected], or provide a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

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

什么是最小化重现,为什么这是必需的?

from ant-design.

stackblitz avatar stackblitz commented on July 1, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

antd v4?

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

fix v5

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

@afc163 @crazyair InputNumber 组件不需要支持 bigInt 吗?我那复现只是一个例子

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

@afc163 @crazyair InputNumber 组件不需要支持 bigInt 吗?我那复现只是一个例子

应该都改成泛型的方式,用户想用什么类型,都是用户自己传的

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

@afc163 @crazyair InputNumber 组件不需要支持 bigInt 吗?我那复现只是一个例子

应该都改成泛型的方式,用户想用什么类型,都是用户自己传的

你可以参考 Checkbox 这个对其他组件进行 fix

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

@crazyair 是否要对所有支持 number 数据类型的组件都让其支持 bigint 类型?

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

@crazyair 是否要对所有支持 number 数据类型的组件都让其支持 bigint 类型?

不是给类型增加什么类型,而是用 T

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

InputNumberProps<T extends ValueType = ValueType> 这种约束的直接去掉就可以 InputNumberProps<T = any>

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

@crazyair 是否要对所有支持 number 数据类型的组件都让其支持 bigint 类型?

不是给类型增加什么类型,而是用 T

我懂你的意思,我想表述的意思是否对所有支持 number 数据类型的组件都改成泛型的形式
image

像这种的话,只支持 number 无可厚非,当然也可以是 bigint , 但改成 T 没有意义
当然还有其他的组件,比如分页

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

@crazyair 是否要对所有支持 number 数据类型的组件都让其支持 bigint 类型?

不是给类型增加什么类型,而是用 T

我懂你的意思,我想表述的意思是否对所有支持 number 数据类型的组件都改成泛型的形式 image

像这种的话,只支持 number 无可厚非,当然也可以是 bigint , 但改成 T 没有意义

这样就属于组件定义的范畴了,如果定死数字类型也不是不可以

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

InputNumberProps<T extends ValueType = ValueType> 这种约束的直接去掉就可以 InputNumberProps<T = any>

当然,ValueType = number | bigint | string 这种类型约束,个人感觉更好。any 意味着任意类型 <InputNumber<number[]> /> 显然不合理
当然,这些只是个人看法

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

InputNumberProps<T extends ValueType = ValueType> 这种约束的直接去掉就可以 InputNumberProps<T = any>

当然,ValueType = number | bigint | string 这种类型约束,个人感觉更好。any 意味着任意类型 <InputNumber<number[]> /> 显然不合理

<InputNumber value={1} 如果这样写了,T 就是 number

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

InputNumberProps<T extends ValueType = ValueType> 这种约束的直接去掉就可以 InputNumberProps<T = any>

当然,ValueType = number | bigint | string 这种类型约束,个人感觉更好。any 意味着任意类型 <InputNumber<number[]> /> 显然不合理

<InputNumber value={1} 如果这样写了,T 就是 number

我知道,但也意味着 value 可以传递任何值,因为它已经不受约束了

<InputNumber value={[1]},

ts 不会报任何错误。但事实是,组件内部应该会报错(当然,我并没有看源码,所以并不清楚是否真的报错)

from ant-design.

crazyair avatar crazyair commented on July 1, 2024

InputNumberProps<T extends ValueType = ValueType> 这种约束的直接去掉就可以 InputNumberProps<T = any>

当然,ValueType = number | bigint | string 这种类型约束,个人感觉更好。any 意味着任意类型 <InputNumber<number[]> /> 显然不合理

<InputNumber value={1} 如果这样写了,T 就是 number

我知道,但也意味着 value 可以传递任何值,因为它已经不受约束了

<InputNumber value={[1]},

这也不会报任何错误。但事实是,组件内部应该会报错(当然,我并没有看源码,所以并不清楚是否真的报错)

报不报错,其实不是要类型来兜底,有的项目还不是 ts 呢?

from ant-design.

guaijie avatar guaijie commented on July 1, 2024

@crazyair 当然,只是你们很多地方都有进行类型约束,比如 select options , option.value 等,你们这样的目的,也是想在使用时就提醒到用户可以支持的类型有哪些。
当然,ts 这玩意本来就增加了库作者的负担,所以,我只是提出个人看法

from ant-design.

afc163 avatar afc163 commented on July 1, 2024

InputNumber 目前支持不了 bigint,不只是类型的问题,组件能力还不支持。

from ant-design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.