diff --git a/packages/useful-types/CHANGELOG.md b/packages/useful-types/CHANGELOG.md index a67ff62c79..a6a81f84e8 100644 --- a/packages/useful-types/CHANGELOG.md +++ b/packages/useful-types/CHANGELOG.md @@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - +## Unreleased + +### Breaking Change + +- `Omit` has been removed. Remove any `import { Omit } from '@shopify/useful-types';` and use the built-in [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) type +- `ThenType` has been removed. You should use the built-in `Awaited` type instead +- `Arguments`, `ArgumentsAtIndex` and `FirstArgument` have been removed. Replace usage of `Arguments` with the built-in [`Parameters`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype) type. Replace usage of `ArgumentAtIndex` with `Parameters[i]` and `FirstArgument` with `Parameters[0]`. +- `ConstructorArguments`, `ConstructorArgumentAtIndex` and `FirstConstructorArgument` have been removed. Replace usage of `ConstructorArguments` with the built-in [`ConstructorParameters`](https://www.typescriptlang.org/docs/handbook/utility-types.html#constructorparameterstype) type. Replace usage of `ConstructorArgumentAtIndex` with `ConstructorParameters[i]` and `FirstConstructorArgument` with `ConstructorParameters[0]` +- `MaybeFunctionReturnType` has been removed. Replace usage of `MaybeFunctionReturnType` with the built-in `ReturnType` type ## 3.1.0 - 2022-02-09 diff --git a/packages/useful-types/src/types.ts b/packages/useful-types/src/types.ts index fd04b8b784..c54d8bd5b2 100644 --- a/packages/useful-types/src/types.ts +++ b/packages/useful-types/src/types.ts @@ -1,20 +1,5 @@ -export type ThenType = T extends Promise ? U : T; - -export type Arguments = T extends (...args: infer U) => any ? U : never; -export type ArgumentAtIndex< - Func, - Index extends keyof Arguments -> = Arguments[Index]; -export type FirstArgument = ArgumentAtIndex; - -export type MaybeFunctionReturnType = T extends (...args: any[]) => infer U - ? U - : never; - export type ArrayElement = T extends (infer U)[] ? U : never; -export type Omit = Pick>; - export type DeepPartial = { [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial[] @@ -67,19 +52,6 @@ export type NonReactStatics = Pick>; export type ExtendedWindow = Window & typeof globalThis & T; -export type ConstructorArguments = T extends { - new (...args: infer U): any; -} - ? U - : never; - -export type ConstructorArgumentAtIndex< - T, - I extends keyof ConstructorArguments -> = ConstructorArguments[I]; - -export type FirstConstructorArgument = ConstructorArgumentAtIndex; - // Reference https://stackoverflow.com/questions/55539387/deep-omit-with-typescript type Primitive = | string