Skip to content

Commit c181cae

Browse files
IvanGoncharovyaacovCR
authored andcommitted
ASTReducer: correctly type scalar values (#3873)
1 parent 19bc432 commit c181cae

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/language/printer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ const printDocASTReducer: ASTReducer<string> = {
150150
FloatValue: { leave: ({ value }) => value },
151151
StringValue: {
152152
leave: ({ value, block: isBlockString }) =>
153-
// @ts-expect-error FIXME: it's a problem with ASTReducer, will be fixed in separate PR
154153
isBlockString === true ? printBlockString(value) : printString(value),
155154
},
156155
BooleanValue: { leave: ({ value }) => (value ? 'true' : 'false') },

src/language/visitor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ type ASTReducerFn<TReducedNode extends ASTNode, R> = (
7171
ancestors: ReadonlyArray<ASTNode | ReadonlyArray<ASTNode>>,
7272
) => R;
7373

74-
type ReducedField<T, R> = T extends null | undefined
75-
? T
76-
: T extends ReadonlyArray<any>
74+
type ReducedField<T, R> = T extends ASTNode
75+
? R
76+
: T extends ReadonlyArray<ASTNode>
7777
? ReadonlyArray<R>
78-
: R;
78+
: T;
7979

8080
/**
8181
* A KeyMap describes each the traversable properties of each kind of node.

0 commit comments

Comments
 (0)