Skip to content

Latest commit

 

History

History
109 lines (72 loc) · 4.71 KB

README.md

File metadata and controls

109 lines (72 loc) · 4.71 KB

types

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

FEMessage basic Typescript type declaration files

中文文档

Table of Contents

Introduction

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.

Install

yarn add -D @femessage/types

⬆ Back to Top

Usage

import { Table,Form } from '@femessage/types/element-ui'

FAQ

What problem was solved?

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.

If the underlying dependency library API is inconsistent with the official API?

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:

  1. Copy the .d.ts file from the FEMessage component to the project locally.
  2. 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

Which FEMessage components are using it?

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

⬆ Back to Top

Contributors

Thanks goes to these wonderful people (emoji key):


4Ark

📖 🌍

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top