Skip to content

Commit 501f668

Browse files
committedJan 3, 2023
Add support for null as input in types
1 parent 8058792 commit 501f668

12 files changed

+39
-39
lines changed
 

‎lib/types.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@
137137
* An entry on some character which is unsafe in certain contexts.
138138
* @property {string} character
139139
* The single character.
140-
* @property {string | Array<string> | undefined} [inConstruct]
140+
* @property {string | Array<string> | null | undefined} [inConstruct]
141141
* Constructs where this is bad.
142-
* @property {string | Array<string> | undefined} [notInConstruct]
142+
* @property {string | Array<string> | null | undefined} [notInConstruct]
143143
* Constructs where this is fine.
144-
* @property {string | undefined} [after]
144+
* @property {string | null | undefined} [after]
145145
* Conditional character before.
146-
* @property {string | undefined} [before]
146+
* @property {string | null | undefined} [before]
147147
* Conditional character after (can’t be used together with `atBreak`).
148-
* @property {boolean | undefined} [atBreak]
148+
* @property {boolean | null | undefined} [atBreak]
149149
* Conditionally, at a break (can’t be used together with `before`).
150-
* @property {RegExp | undefined} [_compiled]
150+
* @property {RegExp | null | undefined} [_compiled]
151151
* The unsafe pattern (this whole object) compiled as a regex.
152152
*
153153
* This is internal and must not be defined.
@@ -156,9 +156,9 @@
156156
/**
157157
* @typedef Options
158158
* Configuration (optional).
159-
* @property {'-' | '*' | '+' | undefined} [bullet='*']
159+
* @property {'-' | '*' | '+' | null | undefined} [bullet='*']
160160
* Marker to use for bullets of items in unordered lists.
161-
* @property {'-' | '*' | '+' | undefined} [bulletOther]
161+
* @property {'-' | '*' | '+' | null | undefined} [bulletOther]
162162
* Marker to use in certain cases where the primary bullet doesn’t work.
163163
*
164164
* There are three cases where the primary bullet can’t be used:
@@ -181,9 +181,9 @@
181181
* To solve for both, we instead inject an empty comment between the two
182182
* lists: `* a\n<!---->\n* b`, but if `bulletOther` is given explicitly,
183183
* it will be used instead
184-
* @property {'.' | ')' | undefined} [bulletOrdered='.']
184+
* @property {'.' | ')' | null | undefined} [bulletOrdered='.']
185185
* Marker to use for bullets of items in ordered lists.
186-
* @property {'.' | ')' | undefined} [bulletOrderedOther]
186+
* @property {'.' | ')' | null | undefined} [bulletOrderedOther]
187187
* Marker to use in certain cases where the primary bullet for ordered items
188188
* doesn’t work.
189189
*
@@ -195,49 +195,49 @@
195195
* To solve for both, we instead inject an empty comment between the two
196196
* lists: `1. a\n<!---->\n1. b`, but if `bulletOrderedOther` is given
197197
* explicitly, it will be used instead
198-
* @property {boolean | undefined} [closeAtx=false]
198+
* @property {boolean | null | undefined} [closeAtx=false]
199199
* Whether to add the same number of number signs (`#`) at the end of an ATX
200200
* heading as the opening sequence.
201-
* @property {'_' | '*' | undefined} [emphasis='*']
201+
* @property {'_' | '*' | null | undefined} [emphasis='*']
202202
* Marker to use for emphasis.
203-
* @property {'~' | '`' | undefined} [fence='`']
203+
* @property {'~' | '`' | null | undefined} [fence='`']
204204
* Marker to use for fenced code.
205-
* @property {boolean | undefined} [fences=false]
205+
* @property {boolean | null | undefined} [fences=false]
206206
* Whether to use fenced code always.
207207
*
208208
* The default is to use fenced code if there is a language defined, if the
209209
* code is empty, or if it starts or ends in blank lines.
210-
* @property {boolean | undefined} [incrementListMarker=true]
210+
* @property {boolean | null | undefined} [incrementListMarker=true]
211211
* Whether to increment the counter of ordered lists items.
212-
* @property {'tab' | 'one' | 'mixed' | undefined} [listItemIndent='tab']
212+
* @property {'tab' | 'one' | 'mixed' | null | undefined} [listItemIndent='tab']
213213
* How to indent the content of list items.
214214
*
215215
* Either with the size of the bullet plus one space (when `'one'`), a tab
216216
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`,
217217
* uses `'one'` if the item and list are tight and `'tab'` otherwise).
218-
* @property {'"' | "'" | undefined} [quote='"']
218+
* @property {'"' | "'" | null | undefined} [quote='"']
219219
* Marker to use for titles.
220-
* @property {boolean | undefined} [resourceLink=false]
220+
* @property {boolean | null | undefined} [resourceLink=false]
221221
* Whether to always use resource links.
222222
*
223223
* The default is to use autolinks (`<https://example.com>`) when possible
224224
* and resource links (`[text](url)`) otherwise.
225-
* @property {'-' | '_' | '*' | undefined} [rule='*']
225+
* @property {'-' | '_' | '*' | null | undefined} [rule='*']
226226
* Marker to use for thematic breaks.
227-
* @property {number | undefined} [ruleRepetition=3]
227+
* @property {number | null | undefined} [ruleRepetition=3]
228228
* Number of markers to use for thematic breaks.
229-
* @property {boolean | undefined} [ruleSpaces=false]
229+
* @property {boolean | null | undefined} [ruleSpaces=false]
230230
* Whether to add spaces between markers in thematic breaks.
231-
* @property {boolean | undefined} [setext=false]
231+
* @property {boolean | null | undefined} [setext=false]
232232
* Whether to use setext headings when possible.
233233
*
234234
* The default is to always use ATX headings (`# heading`) instead of setext
235235
* headings (`heading\n=======`).
236236
* Setext headings can’t be used for empty headings or headings with a rank
237237
* of three or more.
238-
* @property {'_' | '*' | undefined} [strong='*']
238+
* @property {'_' | '*' | null | undefined} [strong='*']
239239
* Marker to use for strong.
240-
* @property {boolean | undefined} [tightDefinitions=false]
240+
* @property {boolean | null | undefined} [tightDefinitions=false]
241241
* Whether to join definitions without a blank line.
242242
*
243243
* The default is to add blank lines between any flow (“block”) construct.
@@ -250,23 +250,23 @@
250250
* }
251251
* }
252252
* ```
253-
* @property {Handlers | undefined} [handlers={}]
253+
* @property {Handlers | null | undefined} [handlers={}]
254254
* Object mapping node types to custom handlers.
255255
*
256256
* Useful for syntax extensions.
257257
* This option is a bit advanced.
258258
* It’s recommended to look at the code in `lib/handle/` in
259259
* `mdast-util-to-markdown` for examples.
260-
* @property {Array<Join> | undefined} [join=[]]
260+
* @property {Array<Join> | null | undefined} [join=[]]
261261
* List of functions used to determine what to place between two flow nodes.
262-
* @property {Array<Unsafe> | undefined} [unsafe=[]]
262+
* @property {Array<Unsafe> | null | undefined} [unsafe=[]]
263263
* List of extra patterns to escape.
264264
*
265265
* Useful for syntax extensions.
266266
* This option is quite advanced.
267267
* It’s recommended to look at the code in `lib/unsafe.js` in
268268
* `mdast-util-to-markdown` for examples.
269-
* @property {Array<Options> | undefined} [extensions=[]]
269+
* @property {Array<Options> | null | undefined} [extensions=[]]
270270
* List of extensions to include.
271271
*
272272
* Each `ToMarkdownExtension` is an object with the same interface as

‎lib/util/check-bullet-ordered-other.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {checkBulletOrdered} from './check-bullet-ordered.js'
77

88
/**
99
* @param {Context} context
10-
* @returns {Exclude<Options['bulletOrdered'], undefined>}
10+
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
1111
*/
1212
export function checkBulletOrderedOther(context) {
1313
const bulletOrdered = checkBulletOrdered(context)

‎lib/util/check-bullet-ordered.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['bulletOrdered'], undefined>}
8+
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
99
*/
1010
export function checkBulletOrdered(context) {
1111
const marker = context.options.bulletOrdered || '.'

‎lib/util/check-bullet-other.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {checkBullet} from './check-bullet.js'
77

88
/**
99
* @param {Context} context
10-
* @returns {Exclude<Options['bullet'], undefined>}
10+
* @returns {Exclude<Options['bullet'], null | undefined>}
1111
*/
1212
export function checkBulletOther(context) {
1313
const bullet = checkBullet(context)

‎lib/util/check-bullet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['bullet'], undefined>}
8+
* @returns {Exclude<Options['bullet'], null | undefined>}
99
*/
1010
export function checkBullet(context) {
1111
const marker = context.options.bullet || '*'

‎lib/util/check-emphasis.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['emphasis'], undefined>}
8+
* @returns {Exclude<Options['emphasis'], null | undefined>}
99
*/
1010
export function checkEmphasis(context) {
1111
const marker = context.options.emphasis || '*'

‎lib/util/check-fence.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['fence'], undefined>}
8+
* @returns {Exclude<Options['fence'], null | undefined>}
99
*/
1010
export function checkFence(context) {
1111
const marker = context.options.fence || '`'

‎lib/util/check-list-item-indent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['listItemIndent'], undefined>}
8+
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
99
*/
1010
export function checkListItemIndent(context) {
1111
const style = context.options.listItemIndent || 'tab'

‎lib/util/check-quote.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['quote'], undefined>}
8+
* @returns {Exclude<Options['quote'], null | undefined>}
99
*/
1010
export function checkQuote(context) {
1111
const marker = context.options.quote || '"'

‎lib/util/check-rule-repetition.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['ruleRepetition'], undefined>}
8+
* @returns {Exclude<Options['ruleRepetition'], null | undefined>}
99
*/
1010
export function checkRuleRepetition(context) {
1111
const repetition = context.options.ruleRepetition || 3

‎lib/util/check-rule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['rule'], undefined>}
8+
* @returns {Exclude<Options['rule'], null | undefined>}
99
*/
1010
export function checkRule(context) {
1111
const marker = context.options.rule || '*'

‎lib/util/check-strong.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @param {Context} context
8-
* @returns {Exclude<Options['strong'], undefined>}
8+
* @returns {Exclude<Options['strong'], null | undefined>}
99
*/
1010
export function checkStrong(context) {
1111
const marker = context.options.strong || '*'

0 commit comments

Comments
 (0)
Please sign in to comment.