Skip to content

Commit 90ba416

Browse files
committed
Export generated types from apollo-language-server and consume them from the root
1 parent 26c3ea7 commit 90ba416

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

packages/apollo-language-server/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ export * from "./engine";
2020

2121
// Config
2222
export * from "./config";
23+
24+
// Generated types
25+
import * as graphqlTypes from "./graphqlTypes";
26+
export { graphqlTypes };

packages/apollo/src/commands/client/check.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import { flags } from "@oclif/command";
2-
import { table } from "heroku-cli-util";
32
import { print } from "graphql";
4-
53
import { gitInfo } from "../../git";
64
import { ClientCommand } from "../../Command";
75
import URI from "vscode-uri";
86
import { relative } from "path";
9-
import {
10-
ValidateOperations_service_validateOperations_validationResults as ValidationResult,
11-
ValidationErrorType
12-
} from "apollo-language-server/src/graphqlTypes";
7+
import { graphqlTypes } from "apollo-language-server";
138
import chalk from "chalk";
149

10+
const { ValidationErrorType } = graphqlTypes;
11+
type ValidationResult = graphqlTypes.ValidateOperations_service_validateOperations_validationResults;
12+
1513
interface Operation {
1614
body: string;
1715
name: string;
@@ -157,7 +155,8 @@ export default class ClientCheck extends ClientCommand {
157155
[ValidationErrorType.INVALID]: [],
158156
[ValidationErrorType.FAILURE]: [],
159157
[ValidationErrorType.WARNING]: []
160-
} as { [key in ValidationErrorType]: ValidationResult[] }
158+
// XXX TS doesn't recognize ValidationErrorType as a type unless prefixed with graphqlTypes
159+
} as { [key in graphqlTypes.ValidationErrorType]: ValidationResult[] }
161160
);
162161

163162
Object.values(byErrorType).map(validations => {

packages/apollo/src/utils/validateHistoricParams.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { duration } from "moment";
2-
import { HistoricQueryParameters } from "apollo-language-server/lib/graphqlTypes";
2+
import { graphqlTypes } from "apollo-language-server";
33

44
export function validateHistoricParams({
55
validationPeriod,
@@ -9,7 +9,7 @@ export function validateHistoricParams({
99
validationPeriod: string;
1010
queryCountThreshold: number;
1111
queryCountThresholdPercentage: number;
12-
}>): Partial<HistoricQueryParameters> | null {
12+
}>): Partial<graphqlTypes.HistoricQueryParameters> | null {
1313
if (
1414
!validationPeriod &&
1515
!queryCountThreshold &&

0 commit comments

Comments
 (0)