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

[switch] typescript 类型未导出 #963

Open
hidden7123 opened this issue Nov 26, 2024 · 0 comments
Open

[switch] typescript 类型未导出 #963

hidden7123 opened this issue Nov 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working typescript

Comments

@hidden7123
Copy link
Contributor

重现链接或代码

import React from 'react'
import ReactDOM from 'react-dom'
import { Switch, Button, ISwitchProps } from '@kdcloudjs/kdesign'

const Demo: React.FC = () => {
  const [checked, setChecked] = React.useState < ISwitchProps['checked'] > true
  const [loading, setLoading] = React.useState < ISwitchProps['loading'] > false

  const toggle: ISwitchProps['onClick'] = () => {
    setChecked(!checked)
  }
  const toggleToLoading: ISwitchProps['onClick'] = () => {
    setLoading(!loading)
  }

  const onChange: ISwitchProps['onChange'] = (checked) => {
    console.log(`switch to ${checked}`)
  }

  return (
    <>
      <br />
      <Switch checked={checked} defaultChecked onChange={onChange} />
      <br />
      <Button type="primary" onClick={toggle}>
        Toggle
      </Button>
      <br />
      <Switch loading={loading} checked={checked} defaultChecked onChange={onChange} />
      <br />
      <Button type="primary" onClick={toggleToLoading}>
        Toggle to loading
      </Button>
    </>
  )
}

ReactDOM.render(<Demo />, mountNode)

重现问题步骤

期望的结果是什么

1.可访问组件的Props类型
2.组件demo中有完整的typescript定义

实际的结果是什么

1.无法访问组件的Props类型
2.组件demo中没有完整的typescript定义

组件库版本号、浏览器信息

组件库与浏览器均为最新版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript
Projects
None yet
Development

No branches or pull requests

2 participants