FEMessage basic Typescript type declaration files
It is mainly used to store the TypeScript type declaration of the underlying dependency package of the FEMessage component library, so that users of the FEMessage component library can use the type declaration normally regardless of which Fork version of the underlying dependency is installed.
Existing Dependency Library type declarations:
- Element
- We'll add others as needed...
The type declaration file of this repository is copied from the official package without any modification.
yarn add -D @femessage/types
import { Table,Form } from '@femessage/types/element-ui'
Add to FEMessage Component Library .d.ts This problem was found during the File: because some components need to rely on the type declaration exported by the Element, FEMessage depends on the official Element, however, it is possible that the user of the FEMessage component library is using another Fork Element (e.g. @femessage/element-ui), which will cause some FEMessage type declarations to fail.
the solution is to copy the type declaration file of the Element to this repository. FEMessage component libraries depend on the type exported by the Element, so use the type file here.
This means that the type declaration of the FEMessage component will not be affected regardless of whether the FEMessage user installs the official Element or the Fork Element.
Actually, it's just Element as an example. In fact, the UI libraries on which the FEMessage component library depends have this problem, such.
However, if the Element installed by FEMessage users is a major change, it will affect API , what should I do?
For example, let's say the user has installed a Fork Element that has made API
changes to the el-table
component. The FEMessage component that relies on this repository cannot be used properly because the API
has become inconsistent, which also causes the type declarations to not match.
If this happens, the solution steps:
- Copy the
.d.ts
file from the FEMessage component to the project locally. - Replace
@femessage/types
in the local.d.ts
file with the Element path used by the project.
- import { Table,Form } from '@femessage/types/element-ui'
+ import { Table,Form } from 'element-ui' // node_modules
The following components are currently in use.
- el-data-table
- el-data-tree
- el-form-renderer
Note: This list may not be updated in time. The actual situation depends on the component's package.json
Thanks goes to these wonderful people (emoji key):
4Ark 📖 🌍 |
This project follows the all-contributors specification. Contributions of any kind welcome!