mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 01:33:08 -05:00
Update return types of APIs (#15887)
* Update types.ts * Update types in parser.ts and scanner.ts
This commit is contained in:
committed by
Mohamed Hegazy
parent
8ceaa33943
commit
5fb77a0901
@@ -23,19 +23,19 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function visitNode<T>(cbNode: (node: Node) => T, node: Node): T {
|
||||
function visitNode<T>(cbNode: (node: Node) => T, node: Node): T | undefined {
|
||||
if (node) {
|
||||
return cbNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
function visitNodeArray<T>(cbNodes: (nodes: Node[]) => T, nodes: Node[]) {
|
||||
function visitNodeArray<T>(cbNodes: (nodes: Node[]) => T, nodes: Node[]): T | undefined {
|
||||
if (nodes) {
|
||||
return cbNodes(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
function visitEachNode<T>(cbNode: (node: Node) => T, nodes: Node[]) {
|
||||
function visitEachNode<T>(cbNode: (node: Node) => T, nodes: Node[]): T | undefined {
|
||||
if (nodes) {
|
||||
for (const node of nodes) {
|
||||
const result = cbNode(node);
|
||||
@@ -50,7 +50,7 @@ namespace ts {
|
||||
// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
|
||||
// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
|
||||
// a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
|
||||
export function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T {
|
||||
export function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T | undefined {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user