@shopify/useful-types
Advanced tools
Comparing version 2.1.5 to 2.2.0-sknext-beta.9
@@ -8,4 +8,8 @@ # Changelog | ||
<!-- ## [Unreleased] --> | ||
## [2.2.0] - 2019-06-12 | ||
### Added | ||
- Added the `ConstructorArguments`, `ConstructorArgumentAtIndex`, and `FirstConstructorArgument` type aliases | ||
## [2.1.4] - 2019-01-27 | ||
@@ -12,0 +16,0 @@ |
{ | ||
"name": "@shopify/useful-types", | ||
"version": "2.1.5", | ||
"version": "2.2.0-sknext-beta.9", | ||
"license": "MIT", | ||
"description": "A few handy TypeScript types", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
@@ -30,5 +30,19 @@ "build": "tsc --p tsconfig.json" | ||
"files": [ | ||
"dist/*", | ||
"!tsconfig.tsbuildinfo" | ||
] | ||
"build/*", | ||
"!tsconfig.tsbuildinfo", | ||
"index.js", | ||
"index.mjs", | ||
"index.esnext", | ||
"index.d.ts" | ||
], | ||
"module": "index.mjs", | ||
"esnext": "index.esnext", | ||
"exports": { | ||
"./": "./", | ||
"./index": { | ||
"import": "./index.mjs", | ||
"require": "./index.js", | ||
"esnext": "./index.esnext" | ||
} | ||
} | ||
} |
@@ -44,2 +44,26 @@ # `@shopify/useful-types` | ||
- `ConstructorArgumentAtIndex<T, Index>`: Resolves to the type of the argument of the passed class's constructor at the passed index. Useful for cases where you wish to extract the type of arguments without actually exporting the argument types, and is a nice complement to TypeScript’s built-in `ReturnType`. | ||
```tsx | ||
class SomeClass { | ||
constructor(floop: string, doop: number) { | ||
console.log(floop); | ||
} | ||
} | ||
type DoopType = ConstructorArgument<typeof SomeClass, 1>; // number | ||
``` | ||
- `FirstConstructorArgument<T>`: Resolves to the type of the first argument to the passed class's constructor. This is shorthand for `ConstructorArgumentAtIndex<T, 0>`. | ||
```ts | ||
class SomeClass { | ||
constructor(floop: string) { | ||
console.log(floop); | ||
} | ||
} | ||
type DoopType = FirstConstructorArgument<typeof SomeClass>; // string | ||
``` | ||
- `ArrayElement<T>`: When `T` is an array, resolves to the type contained within the array. | ||
@@ -46,0 +70,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
12367
21
70
108
1