Skip to content

Commit

Permalink
Extract TypeScript utility types into apollo-env and add DeepPartial
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Nov 9, 2018
1 parent 09c7b94 commit 384172b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/apollo-env/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./polyfills";
import "./global-fetch";
import "./typescript-utility-types";

export * from "./fetch";
export * from "./url";
2 changes: 2 additions & 0 deletions packages/apollo-env/src/typescript-utility-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
3 changes: 0 additions & 3 deletions packages/apollo-language-server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import {
ServiceIDAndTag
} from "./engine";

// TypeScript util requiring an optional field
export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;

export interface EngineStatsWindow {
to: number;
from: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export abstract class ProjectCommand extends Command {
public tasks: ListrTask[] = [];

protected type: "service" | "client" = "service";
protected configMap?: (flags: any) => any;
protected configMap?: (flags: any) => DeepPartial<ApolloConfig>;
private ctx!: ProjectContext;

async init() {
Expand Down

0 comments on commit 384172b

Please sign in to comment.