ts-essentials
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -35,2 +35,4 @@ /** Essentials */ | ||
}; | ||
/** Easily extract the type of a given object's values */ | ||
export declare type ValueOf<T> = T[keyof T]; | ||
export {}; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,4 @@ "types": "dist/types.d.ts", | ||
"prepublishOnly": "yarn test && yarn build", | ||
"test": "tsc --noEmit" | ||
"test": "prettier -c **/*.ts && tsc --noEmit", | ||
"test:fix": "prettier --write **/*.ts && tsc --noEmit" | ||
}, | ||
@@ -27,4 +28,5 @@ "files": [ | ||
"conditional-type-checks": "^0.5.0", | ||
"prettier": "^1.16.1", | ||
"typescript": "^3.2.2" | ||
} | ||
} |
@@ -7,2 +7,3 @@ <p align="center"> | ||
<img alt="Downloads" src="https://img.shields.io/npm/dm/ts-essentials.svg"> | ||
<img alt="Build status" src="https://circleci.com/gh/krzkaczor/ts-essentials.svg?style=svg"> | ||
<a href="/package.json"><img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square"></a> | ||
@@ -37,3 +38,4 @@ </p> | ||
- [Literal types](#literal-types) | ||
- [Exhaustive switch cases](#exhaustive-switch-cases-in-typescript) | ||
- [Exhaustive switch cases](#exhaustive-switch-cases) | ||
- [ValueOf](#valueof-type) | ||
@@ -162,1 +164,18 @@ ### Basic: | ||
``` | ||
### ValueOf type | ||
```typescript | ||
const obj = { | ||
id: "123e4567-e89b-12d3-a456-426655440000", | ||
name: "Test object", | ||
timestamp: 1548768231486, | ||
}; | ||
type objKeys = ValueOf<typeof obj>; // string | number | ||
``` | ||
## Contributing | ||
All contributions are welcomed [Read more](./CONTRIBUTING.md) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8128
64
178
3