Public Type
约 111 字小于 1 分钟
2026-02-11
题目
Remove the key starting with _ from given type T.
解题思路
待补充
答案
type PublicType<T extends object> = any验证
import type { Equal, Expect } from '@type-challenges/utils'
type cases = [
Expect<Equal<PublicType<{ a: number }>, { a: number }>>,
Expect<Equal<PublicType<{ _b: string | bigint }>, {}>>,
Expect<Equal<PublicType<{ readonly c?: number }>, { readonly c?: number }>>,
Expect<Equal<PublicType<{ d: string, _e: string }>, { d: string }>>,
Expect<Equal<PublicType<{ _f: () => bigint[] }>, {}>>,
Expect<Equal<PublicType<{ g: '_g' }>, { g: '_g' }>>,
Expect<Equal<PublicType<{ __h: number, i: unknown }>, { i: unknown }>>,
]参考
无
