Skip to content

Commit

Permalink
Update types for changes in micromark-util-types
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed May 30, 2023
1 parent 08de832 commit 7c6a7f8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules/
/lib/
/index.js
yarn.lock
!dev/index.d.ts
22 changes: 22 additions & 0 deletions dev/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export {mathHtml, type Options as HtmlOptions} from './lib/html.js'
export {math, type Options} from './lib/syntax.js'

declare module 'micromark-util-types' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface TokenTypeMap {
mathFlow: 'mathFlow'
mathFlowFence: 'mathFlowFence'
mathFlowFenceMeta: 'mathFlowFenceMeta'
mathFlowFenceSequence: 'mathFlowFenceSequence'
mathFlowValue: 'mathFlowValue'
mathText: 'mathText'
mathTextData: 'mathTextData'
mathTextPadding: 'mathTextPadding'
mathTextSequence: 'mathTextSequence'
}

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface CompileData {
mathFlowOpen?: boolean
}
}
6 changes: 1 addition & 5 deletions dev/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @typedef {import('./lib/html.js').Options} HtmlOptions
* @typedef {import('./lib/syntax.js').Options} Options
*/

// Note: types exported from `index.d.ts`.
export {math} from './lib/syntax.js'
export {mathHtml} from './lib/html.js'
1 change: 1 addition & 0 deletions dev/lib/math-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ function tokenizeMathFenced(effects, ok, nok) {
function tokenizeClosingFence(effects, ok, nok) {
let size = 0

assert(self.parser.constructs.disable.null, 'expected `disable.null`')
/**
* Before closing fence, at optional whitespace.
*
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["**/*.js"],
"include": ["**/*.js", "dev/index.d.ts"],
"exclude": ["coverage/", "lib/", "node_modules/", "index.js"],
"compilerOptions": {
"customConditions": ["development"],
Expand Down

0 comments on commit 7c6a7f8

Please sign in to comment.