Skip to content

Commit c2fae2e

Browse files
committed
Fix type to allow explicit null, etc
1 parent 9824e56 commit c2fae2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,17 @@ const blockOrCaption = convertElement([
148148
*
149149
* @param {Nodes} tree
150150
* Tree to turn into text.
151-
* @param {Options} [options]
151+
* @param {Readonly<Options> | null | undefined} [options]
152152
* Configuration (optional).
153153
* @returns {string}
154154
* Serialized `tree`.
155155
*/
156-
export function toText(tree, options = {}) {
156+
export function toText(tree, options) {
157+
const options_ = options || {}
157158
const children = 'children' in tree ? tree.children : []
158159
const block = blockOrCaption(tree)
159160
const whitespace = inferWhitespace(tree, {
160-
whitespace: options.whitespace || 'normal',
161+
whitespace: options_.whitespace || 'normal',
161162
breakBefore: false,
162163
breakAfter: false
163164
})

0 commit comments

Comments
 (0)