Skip to content

Commit 23cbcec

Browse files
committed
add backwards-compatible name property
1 parent 4cc713a commit 23cbcec

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/operation-node/drop-type-node.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export type DropTypeNodeParams = Omit<Partial<DropTypeNode>, 'kind' | 'names'>
66

77
export interface DropTypeNode extends OperationNode {
88
readonly kind: 'DropTypeNode'
9+
/** @deprecated Use `names` instead. */
10+
readonly name?: SchemableIdentifierNode
911
readonly names: SchemableIdentifierNode[]
1012
readonly ifExists?: boolean
1113
readonly modifier?: 'cascade' | 'restrict'
@@ -19,10 +21,11 @@ export const DropTypeNode = freeze({
1921
return node.kind === 'DropTypeNode'
2022
},
2123

22-
create(names: SchemableIdentifierNode[]): DropTypeNode {
24+
create(names: SchemableIdentifierNode | SchemableIdentifierNode[]): DropTypeNode {
2325
return freeze({
2426
kind: 'DropTypeNode',
25-
names,
27+
name: Array.isArray(names) ? undefined : names,
28+
names: Array.isArray(names) ? names : [names],
2629
})
2730
},
2831

src/operation-node/operation-node-transformer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ export class OperationNodeTransformer {
10311031
): DropTypeNode {
10321032
return requireAllProps<DropTypeNode>({
10331033
kind: 'DropTypeNode',
1034+
name: this.transformNode(node.name, queryId),
10341035
names: this.transformNodeList(node.names, queryId),
10351036
ifExists: node.ifExists,
10361037
modifier: node.modifier,

0 commit comments

Comments
 (0)