Skip to content

Commit

Permalink
feat(question): add type-challenges#28333 - Public Type (type-challen…
Browse files Browse the repository at this point in the history
…ges#28334)

Co-authored-by: KaiKai <99722991+kaikaibenkai@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and kaikaibenkai authored Jun 26, 2023
1 parent f0da15b commit f77d878
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions questions/28333-medium-public-type/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the key starting with `_` from given type `T`.
7 changes: 7 additions & 0 deletions questions/28333-medium-public-type/info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
difficulty: medium
title: Public Type
tags: object-keys
author:
github: kaikaibenkai
name: KaiKai

1 change: 1 addition & 0 deletions questions/28333-medium-public-type/template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type PublicType<T extends object> = any
11 changes: 11 additions & 0 deletions questions/28333-medium-public-type/test-cases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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 }>>
]

0 comments on commit f77d878

Please sign in to comment.