Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop generic Unwrap in favor of built-in Awaited #18

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/methods/getComments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { gql } from "code-tag";
import type { Unwrap } from "../types";
import type { GithubBlog } from "../github-blog";
import { GithubQueryParams } from "../utils/github-query";
import { PagerParams } from "../utils/pager";
Expand Down Expand Up @@ -73,4 +72,4 @@ export const getComments = (blog: GithubBlog) => async (params: GetCommentsParam

export type GetComments = ReturnType<typeof getComments>;

export type GetCommentsResult = Unwrap<ReturnType<GetComments>>;
export type GetCommentsResult = Awaited<ReturnType<GetComments>>;
3 changes: 1 addition & 2 deletions src/methods/getLabels.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { gql } from "code-tag";
import type { GithubBlog } from "../github-blog";
import type { Unwrap } from "../types";
import { isNonNull } from "../utils/func";
import { PagerParams } from "../utils/pager";
import { Label } from "../datatypes/Label";
Expand Down Expand Up @@ -70,4 +69,4 @@ export const getLabels = (blog: GithubBlog) => async (params?: GetLabelsParams)

export type GetLabels = ReturnType<typeof getLabels>;

export type GetLabelsResult = Unwrap<ReturnType<GetLabels>>;
export type GetLabelsResult = Awaited<ReturnType<GetLabels>>;
3 changes: 1 addition & 2 deletions src/methods/getPinnedPosts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { gql } from "code-tag";
import type { Unwrap } from "../types";
import type { GithubBlog } from "../github-blog";
import { isNonNull } from "../utils/func";
import { PostReduced } from "../datatypes/PostReduced";
Expand Down Expand Up @@ -40,4 +39,4 @@ export const getPinnedPosts = (blog: GithubBlog) => async () => {

export type GetPinnedPosts = ReturnType<typeof getPinnedPosts>;

export type GetPinnedPostsResult = Unwrap<ReturnType<GetPinnedPosts>>;
export type GetPinnedPostsResult = Awaited<ReturnType<GetPinnedPosts>>;
3 changes: 1 addition & 2 deletions src/methods/getPost.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { gql } from "code-tag";
import type { Unwrap } from "../types";
import type { GithubBlog } from "../github-blog";
import { Post } from "../datatypes/Post";
import { GithubQueryParams } from "../utils/github-query";
Expand Down Expand Up @@ -38,4 +37,4 @@ export const getPost = (blog: GithubBlog) => async (params: GetPostParams) => {

export type GetPost = ReturnType<typeof getPost>;

export type GetPostResult = Unwrap<ReturnType<GetPost>>;
export type GetPostResult = Awaited<ReturnType<GetPost>>;
3 changes: 1 addition & 2 deletions src/methods/getPosts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { gql } from "code-tag";
import type { Unwrap } from "../types";
import type { GithubBlog } from "../github-blog";
import { GithubQueryParams } from "../utils/github-query";
import { isNonNull } from "../utils/func";
Expand Down Expand Up @@ -65,4 +64,4 @@ export const getPosts = (blog: GithubBlog) => async (params: GetPostsParams) =>

export type GetPosts = ReturnType<typeof getPosts>;

export type GetPostsResult = Unwrap<ReturnType<GetPosts>>;
export type GetPostsResult = Awaited<ReturnType<GetPosts>>;
2 changes: 0 additions & 2 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from "../__generated__/index";

export type Unwrap<T> = T extends Promise<infer U> ? U : never;