mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #64731 commonmark: include null as possibility for NodeWalker.next by @zombiezen
* commonmark: include null as possibility for NodeWalker.next * Update test * Fix initial part of test
This commit is contained in:
@@ -28,7 +28,7 @@ const node = parser.parse('# a piece of _markdown_');
|
||||
|
||||
const w = node.walker();
|
||||
const step = w.next();
|
||||
if (step.entering) {
|
||||
if (step?.entering) {
|
||||
logNode(step.node);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ function soft_breaks_as_spaces() {
|
||||
|
||||
function text_to_ALL_CAPS(parsed: commonmark.Node) {
|
||||
const walker = parsed.walker();
|
||||
let event: commonmark.NodeWalkingStep;
|
||||
let event: commonmark.NodeWalkingStep | null;
|
||||
let node: commonmark.Node;
|
||||
|
||||
event = walker.next();
|
||||
@@ -85,7 +85,7 @@ function text_to_ALL_CAPS(parsed: commonmark.Node) {
|
||||
|
||||
function emphasis_to_ALL_CAPS(parsed: commonmark.Node) {
|
||||
const walker = parsed.walker();
|
||||
let event: commonmark.NodeWalkingStep;
|
||||
let event: commonmark.NodeWalkingStep | null;
|
||||
let node: commonmark.Node;
|
||||
let inEmph = false;
|
||||
|
||||
|
||||
2
types/commonmark/index.d.ts
vendored
2
types/commonmark/index.d.ts
vendored
@@ -178,7 +178,7 @@ export interface NodeWalker {
|
||||
/**
|
||||
* Returns an object with properties entering and node. Returns null when we have finished walking the tree.
|
||||
*/
|
||||
next(): NodeWalkingStep;
|
||||
next(): NodeWalkingStep | null;
|
||||
/**
|
||||
* Resets the iterator to resume at the specified node and setting for entering. (Normally this isn't needed unless you do destructive updates to the Node tree.)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user