Skip to content

Commit 60f2a22

Browse files
committed
⬆️ Upgraded graphql
1 parent 4f4b7d7 commit 60f2a22

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/Models/Types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Kind } from 'graphql';
12
import { TypeDefinitionDisplayStrings, TypeSystemDefinitionDisplayStrings } from './DisplayMap';
23
import {
34
Helpers,
@@ -29,6 +30,7 @@ export type AllTypes =
2930
| Helpers
3031
| Type;
3132

33+
export const kindAsAllTypes = (v: Kind) => v as unknown as AllTypes;
3234
export interface GraphQLNodeParams {
3335
type: AllTypes;
3436
}

src/Parser/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
isTypeSystemExtensionNode,
88
parse,
99
} from 'graphql';
10-
import { AllTypes, ParserField, ParserTree, TypeDefinitionDisplayMap, Options } from '@/Models';
10+
import { ParserField, ParserTree, TypeDefinitionDisplayMap, Options, kindAsAllTypes } from '@/Models';
1111
import { Directive, Helpers, OperationType, TypeDefinition, TypeExtension } from '@/Models/Spec';
1212
import { TypeResolver } from './typeResolver';
1313
import { ParserUtils } from './ParserUtils';
@@ -48,14 +48,14 @@ export class Parser {
4848
fieldType: { name: TypeDefinitionDisplayMap[d.kind], type: Options.name },
4949
},
5050
data: {
51-
type: d.kind as AllTypes,
51+
type: kindAsAllTypes(d.kind),
5252
},
5353

5454
...('description' in d && d.description?.value ? { description: d.description.value } : {}),
5555
interfaces,
5656
directives,
5757
args,
58-
id: generateNodeId(d.name.value, d.kind as AllTypes, args),
58+
id: generateNodeId(d.name.value, kindAsAllTypes(d.kind), args),
5959
};
6060
}
6161
}

src/Parser/typeResolver.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
TypeSystemExtensionNode,
1111
ValueNode,
1212
} from 'graphql';
13-
import { AllTypes, Options, ParserField } from '@/Models';
13+
import { AllTypes, kindAsAllTypes, Options, ParserField } from '@/Models';
1414
import { Instances, TypeSystemDefinition, Value, ValueDefinition } from '@/Models/Spec';
1515
import { generateNodeId } from '@/shared';
1616

@@ -127,15 +127,15 @@ export class TypeResolver {
127127
interfaces: [],
128128
args,
129129
data: {
130-
type: value.kind as AllTypes,
130+
type: kindAsAllTypes(value.kind),
131131
},
132132
type: {
133133
fieldType: {
134-
name: value.kind as AllTypes,
134+
name: kindAsAllTypes(value.kind),
135135
type: Options.name,
136136
},
137137
},
138-
id: generateNodeId(value.kind, value.kind as AllTypes, args),
138+
id: generateNodeId(value.kind, kindAsAllTypes(value.kind), args),
139139
},
140140
];
141141
}
@@ -149,15 +149,15 @@ export class TypeResolver {
149149
directives: [],
150150
interfaces: [],
151151
data: {
152-
type: value.kind as AllTypes,
152+
type: kindAsAllTypes(value.kind),
153153
},
154154
type: {
155155
fieldType: {
156-
name: value.kind as AllTypes,
156+
name: kindAsAllTypes(value.kind),
157157
type: Options.name,
158158
},
159159
},
160-
id: generateNodeId(value.kind, value.kind as AllTypes, args),
160+
id: generateNodeId(value.kind, kindAsAllTypes(value.kind), args),
161161
},
162162
];
163163
}
@@ -169,15 +169,15 @@ export class TypeResolver {
169169
directives: [],
170170
interfaces: [],
171171
data: {
172-
type: value.kind as AllTypes,
172+
type: kindAsAllTypes(value.kind),
173173
},
174174
type: {
175175
fieldType: {
176176
name: value.value as AllTypes,
177177
type: Options.name,
178178
},
179179
},
180-
id: generateNodeId(value.value, value.kind as AllTypes, []),
180+
id: generateNodeId(value.value, kindAsAllTypes(value.kind), []),
181181
},
182182
];
183183
}
@@ -196,9 +196,9 @@ export class TypeResolver {
196196
directives: [],
197197
interfaces: [],
198198
data: {
199-
type: value.kind as AllTypes,
199+
type: kindAsAllTypes(value.kind),
200200
},
201-
id: generateNodeId(name, value.kind as AllTypes, []),
201+
id: generateNodeId(name, kindAsAllTypes(value.kind), []),
202202
},
203203
];
204204
}

0 commit comments

Comments
 (0)