TypeScript type ignore case

后端 未结 4 1218
悲哀的现实
悲哀的现实 2021-02-12 22:42

I have this type definition in TypeScript:

export type xhrTypes = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"OPTIONS\" | \"CONNECT\" | \"HEAD\";
4条回答
  •  误落风尘
    2021-02-12 23:02

    Just so there's an answer on this post: No, it is not possible.

    Update 5/15/2018: Still not possible. The closest thing, regex-validated string types, was not well-received the most recent time it was proposed at the language design meeting.

提交回复
热议问题