sql-parser-cst
Advanced tools
Comparing version 0.12.0 to 0.12.1
import { Node } from "./cst/Node"; | ||
type NodeByType<TType, TNode> = Extract<TNode, { | ||
type: TType; | ||
}>; | ||
/** | ||
@@ -10,7 +13,6 @@ * A map with a transform function for each Node type, like: | ||
*/ | ||
export type FullTransformMap<T> = { | ||
[K in Node["type"]]: (node: Extract<Node, { | ||
type: K; | ||
}>) => T; | ||
export type FullTransformMap<T, TNode extends Node = Node> = { | ||
[TType in TNode["type"]]: (node: NodeByType<TType, TNode>) => T; | ||
}; | ||
export type TransformMap<T, TNode extends Node = Node> = Partial<FullTransformMap<T, TNode>>; | ||
/** | ||
@@ -20,2 +22,3 @@ * Creates a function that transforms the whole syntax tree to data type T. | ||
*/ | ||
export declare function cstTransformer<T>(map: Partial<FullTransformMap<T>>): (node: Node) => T; | ||
export declare function cstTransformer<T>(map: TransformMap<T>): (node: Node) => T; | ||
export {}; |
@@ -5,3 +5,3 @@ { | ||
"license": "GPL-2.0-or-later", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"main": "lib/main.js", | ||
@@ -8,0 +8,0 @@ "types": "lib/main.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2155563
65837