Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
use typescript native types
Browse files Browse the repository at this point in the history
changelog

remove homemade types

also this one

reword changelog
  • Loading branch information
m4thieulavoie committed Feb 9, 2022
1 parent e9b40c9 commit 1437d76
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
1 change: 1 addition & 0 deletions packages/useful-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Added

- Added `PartialSome` and `RequireSome` types to set specified fields of a property to optional or required
- Deprecate `ThenType`, `Omit`, `Arguments`, `ArgumentAtIndex`, `FirstArgument`, `MaybeFunctionReturnType`, `ConstructorArguments`, `ConstructorArgumentAtIndex` and `FirstConstructorArgument` in favour of their Typescript counterparts

## 3.0.7 - 2022-02-01

Expand Down
28 changes: 0 additions & 28 deletions packages/useful-types/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
export type ThenType<T> = T extends Promise<infer U> ? U : T;

export type Arguments<T> = T extends (...args: infer U) => any ? U : never;
export type ArgumentAtIndex<
Func,
Index extends keyof Arguments<Func>
> = Arguments<Func>[Index];
export type FirstArgument<T> = ArgumentAtIndex<T, 0>;

export type MaybeFunctionReturnType<T> = T extends (...args: any[]) => infer U
? U
: never;

export type ArrayElement<T> = T extends (infer U)[] ? U : never;

export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? DeepPartial<U>[]
Expand Down Expand Up @@ -67,19 +52,6 @@ export type NonReactStatics<T> = Pick<T, Exclude<keyof T, ReactStatics>>;

export type ExtendedWindow<T> = Window & typeof globalThis & T;

export type ConstructorArguments<T> = T extends {
new (...args: infer U): any;
}
? U
: never;

export type ConstructorArgumentAtIndex<
T,
I extends keyof ConstructorArguments<T>
> = ConstructorArguments<T>[I];

export type FirstConstructorArgument<T> = ConstructorArgumentAtIndex<T, 0>;

// Reference https://stackoverflow.com/questions/55539387/deep-omit-with-typescript
type Primitive =
| string
Expand Down

0 comments on commit 1437d76

Please sign in to comment.