Skip to content

๐Ÿ†ƒ FEMessage basic Typescript type declaration files

License

Notifications You must be signed in to change notification settings

FEMessage/types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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