From d42cbc7d2ca2fa9ab8f7334292dd02a6b3e2738f Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Fri, 9 Aug 2024 11:27:33 +0800 Subject: [PATCH] doc: update docs/typescript.md --- docs/typescript.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/typescript.md b/docs/typescript.md index e9059cc..96c06f0 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -1495,6 +1495,18 @@ function makeBox(value: T) { } ``` +### 保留一段时间字符串常量类型 + +```ts +type Color = "primary" | "secondary" | string; +``` + +修改成下面代码,有代码下拉提示 + +```ts +type Color = "primary" | "secondary" | (string & {}); +``` + --- 不使用: