1

I want to import the CheckboxChangeEvent interface into my typescript file. Although importing other antd elements is as simple as:

import {Checkbox} from 'antd'

... for the CheckboxChangeEvent after some grepping I resorted to doing:

import {CheckboxChangeEvent} from '../../../node_modules/antd/es/checkbox'

... where of course the number of parent path components (..) depends on how deep I am in my source tree structure. Regardless, this seems to be the only way to make it work.

I've tried:

import {CheckboxChangeEvent} from 'antd/checkbox'; 
import {CheckboxChangeEvent} from 'antd/checkbox/Checkbox'; 

... and some other permutations and they all fail.

Is there a better way?

1
  • if CheckboxChangeEvent is exported, may be webpack alias can do the trick? Commented Feb 19, 2021 at 16:28

2 Answers 2

2

success!

import type { CheckboxChangeEvent } from 'antd/es/checkbox'

https://github.com/ant-design/ant-design/blob/7bd78e7156e0101a6d635b174751b3b686a066ab/components/checkbox/demo/basic.md

Sign up to request clarification or add additional context in comments.

Comments

0

This PR exports some common types, and it has a review comment that CheckboxChangeEvent should also be exported, but it was never done before PR completion.

https://github.com/ant-design/ant-design/pull/28963/files

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.