Skip to content

Public Type

题目

Remove the key starting with _ from given type T.

解答

ts
type PublicType<T extends object> = {
  [P in keyof T as P extends `_${infer _}` ? never : P]: T[P];
};

Released under the MIT License.