Skip to content

Commit 396bd68

Browse files
committed
feat: add AnyEnum Q&A in documentation
1 parent fa53077 commit 396bd68

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,10 @@ const WeekEnum = Enum(weekInit);
14321432

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

1435+
### I want to define a generic enum type that can represent any enum. The current enum type definition is too complex. Is there a simple way?
1436+
1437+
Please use the `AnyEnum` type, which is a generic enum type that can represent any enum.
1438+
14351439
### I saw in the release notes that you made Jest and Playwright share the same set of test code, which is interesting. Can you introduce how to achieve this?
14361440

14371441
Yes, actually it wasn't easy from the beginning. The working principles of Jest and Playwright are quite different. Jest runs in a Node.js environment, while Playwright runs in a browser environment and then returns to the Node.js environment to execute assertions. To make them share a set of test code, we did the following:

README.zh-CN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,10 @@ const WeekEnum = Enum(weekInit);
14171417

14181418
这是因为 `tsconfig.json` 的配置不正确,请仔细阅读 [迁移指南](./docs/migration-guide-v2-to-v3.zh-CN.md#升级-typescript)
14191419

1420+
### 我想定义一个通用的枚举类型,可以表示任意枚举,目前的枚举类型定义太复杂了,有没有简单的办法?
1421+
1422+
请使用 `AnyEnum` 类型,它是一个通用的枚举类型,可以表示任意枚举。
1423+
14201424
### 我在发行公告里看到,你们让 Jest 和 Playwright 共享了同一套测试代码,这很有意思。能介绍一下如何实现的吗?
14211425

14221426
是的,这并不轻松。Jest 和 Playwright 的工作原理并不相同,Jest 运行在 Node.js 环境中,而 Playwright 运行在浏览器环境中。为了让它们共享一套测试代码,我们做了以下工作:

0 commit comments

Comments
 (0)