Skip to content

Commit b650594

Browse files
committed
docs: add FAQ section on TypeScript type hints in README files
1 parent daa3861 commit b650594

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ What other exciting features are there? Please continue to explore! Or you can c
5858
</a>
5959
</p>
6060

61+
[Why my project has no TypeScript type hints after installation?](#why-my-project-has-no-typescript-type-hints-after-installation)
62+
6163
<details>
6264
<summary>Here are some hot questions, feel free to check them out</summary>
6365

@@ -1438,10 +1440,6 @@ import { Select } from 'antd';
14381440

14391441
> If you are using the `@enum-plus/plugin-i18next` plugin, or have implemented the `Enum.localize` method yourself and it returns a string, then the search functionality in the dropdown should work correctly.
14401442
1441-
### Do I have to install TypeScript? What if my project is in JavaScript?
1442-
1443-
Don't worry, whether your project is in TypeScript or JavaScript, `enum-plus` works perfectly fine. Both of them can benefit from type safety and intelligent code completion. You don't have to install TypeScript dependencies in your project, since modern code editors like VSCode have built-in support for TypeScript.
1444-
14451443
### Do I have to upgrade TypeScript to version 5.0+?
14461444

14471445
Not necessarily. The purpose of upgrading to TypeScript 5.0 is to provide a better development experience. If you choose not to upgrade, it will still work fine with just a little extra effort.
@@ -1464,6 +1462,10 @@ const weekInit = { Sunday: 0, Monday: 1 };
14641462
const WeekEnum = Enum(weekInit);
14651463
```
14661464

1465+
### Why my project has no TypeScript type hints after installation?
1466+
1467+
This is due to incorrect configuration in `tsconfig.json`. Please read the [Migration Guide](./docs/migration-guide-v2-to-v3.md#modify-tsconfigjson) carefully.
1468+
14671469
### Why did all enum types become `any` after upgrading to version 3.0?
14681470

14691471
This is due to incorrect configuration in `tsconfig.json`. Please read the [Migration Guide](./docs/migration-guide-v2-to-v3.md#upgrade-typescript) carefully.

README.zh-CN.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
</a>
5959
</p>
6060

61+
[为什么我的项目安装后没有 TypeScript 类型提示?](#为什么我的项目安装后没有-typescript-类型提示)
62+
6163
<details>
6264
<summary>这里有几个常见问题,有兴趣也可以阅读一下</summary>
6365

@@ -1449,9 +1451,9 @@ const weekInit = { Sunday: 0, Monday: 1 };
14491451
const WeekEnum = Enum(weekInit);
14501452
```
14511453

1452-
### 为什么升级到 3.0 之后,所有枚举的类型都变成了 any
1454+
### 为什么我的项目安装后没有 TypeScript 类型提示
14531455

1454-
这是因为 `tsconfig.json` 的配置不正确,请仔细阅读 [迁移指南](./docs/migration-guide-v2-to-v3.zh-CN.md#升级-typescript)
1456+
这是因为 tsconfig.json 中的配置不正确,请参考[这篇文档](./docs/migration-guide-v2-to-v3.zh-CN.md#修改-tsconfigjson),了解更多详情
14551457

14561458
### 我想定义一个通用的枚举类型,可以表示任意枚举,目前的枚举类型定义太复杂了,有没有简单的办法?
14571459

0 commit comments

Comments
 (0)