1.0.1 • Published 4 years ago
ts-property-util-types v1.0.1
Installation
Install ts-property-util-types
using npm:
$ npm install --save-dev ts-property-util-types
Or, if you prefer yarn:
$ yarn add --dev ts-property-util-types
Usage
import { ExtractProperties } from "ts-property-util-types"
interface Person {
age: number
name: string
}
type OnlyNumberPropertiesOfPerson = ExtractProperties<Person, number>
//=> { age: number }
API
Click the type names for complete docs.
ExcludeKeys
- Create a list of keys that do not have a certain associated value type.ExcludeProperties
- Create a type from an object type without keys that have a certain associated value type.ExtractKeys
- Create a list of keys that have a certain associated value type.ExtractProperties
- Create a type from an object type with only keys that have a certain associated value type.OptionalUndefined
- Create a type from an object type where properties that can be assigned undefined are also optional.
License
This package is available as open source under the terms of the MIT License.