Typescipt-交集类型-唯一符号

我不知道如何填写。

export declare type AttributeKey = string & {
  readonly ___attributeKey: unique symbol;
};

const test: AttributeKey = ????

有人可以帮我吗?

zxj3125 回答:Typescipt-交集类型-唯一符号

您永远无法满足与其他任何字符相交的字符串文字类型。

因此您将无法分配AttributeKey类型的任何内容

编辑:https://github.com/Microsoft/TypeScript/issues/9410

本文链接:https://www.f2er.com/3132953.html

大家都在问