1 Star 0 Fork 0

Sunny / type-challenges

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
jiangshanmeta 提交于 2023-12-31 04:05 . chore: update index

IsFixedStringLiteralType medium

by 蛭子屋双六 @sugoroku-y

Take the Challenge    日本語

Sometimes you may want to determine whether a string literal is a definite type. For example, when you want to check whether the type specified as a class identifier is a fixed string literal type.

type Action<ID extends string> = { readonly id: ID };

Since it must be fixed, the following types must be determined as false.

  • never type
  • Union of string literal types
  • Template literal types with embedded string, number, bigint, boolean

Determine whether the given type S is a definite string literal type.


Back Share your Solutions Check out Solutions
1
https://gitee.com/ztes/type-challenges.git
git@gitee.com:ztes/type-challenges.git
ztes
type-challenges
type-challenges
main

搜索帮助