@@ -3,22 +3,40 @@ import type { Parsable } from "./parsable";
3
3
import type { ParseNode } from "./parseNode" ;
4
4
import type { SerializationWriter } from "./serializationWriter" ;
5
5
6
+ /** Defines the base interface for defining an untyped node. */
6
7
export interface UntypedNode extends Parsable {
7
- getValue ( ) : any
8
+ /**
9
+ * Gets the value of the UntypedNode.
10
+ */
11
+ getValue ( ) : any ;
12
+ /**
13
+ * The value represented by the UntypedNode.
14
+ */
8
15
value ?: any ;
9
16
}
10
17
18
+ /**
19
+ * Factory to create an UntypedNode from a string during deserialization.
20
+ */
11
21
export function createUntypedNodeFromDiscriminatorValue (
12
22
_parseNode : ParseNode | undefined ,
13
23
) : ( instance ?: Parsable ) => Record < string , ( node : ParseNode ) => void > {
14
24
return deserializeIntoUntypedNode ;
15
25
}
16
26
27
+ /**
28
+ * Type guard to assert that an object instance is an UntypedNode.
29
+ * @param node The object to check.
30
+ * @return boolean indicating if the node is an UntypedNode.
31
+ */
17
32
export function isUntypedNode ( node : any ) : node is UntypedNode {
18
33
const potentialNode = node as UntypedNode ;
19
34
return potentialNode && potentialNode . getValue !== undefined ;
20
35
}
21
36
37
+ /**
38
+ * The deserialization implementation for UntypedNode.
39
+ */
22
40
export function deserializeIntoUntypedNode (
23
41
untypedNode : Partial < UntypedNode > | undefined = { } ,
24
42
) : Record < string , ( node : ParseNode ) => void > {
@@ -32,6 +50,9 @@ export function deserializeIntoUntypedNode(
32
50
} ;
33
51
}
34
52
53
+ /**
54
+ * The serialization implementation for UntypedNode.
55
+ */
35
56
export function serializeUntypedNode (
36
57
_writer : SerializationWriter ,
37
58
_errorDetails : Partial < UntypedNode > | undefined = { } ,
0 commit comments