Skip to content

Commit

Permalink
Convert types.d.mts from ambient module declaration to module augment…
Browse files Browse the repository at this point in the history
…ation which enables VS Code to handle `@type {import("markdownlint").Rule}` (https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules), fix broken markdownlint @typedefs in helpers/*.cjs.
  • Loading branch information
DavidAnson committed Dec 11, 2024
1 parent 6737ace commit 8b26129
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions helpers/helpers.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module.exports.newLineRe = newLineRe;
module.exports.nextLinesRe = nextLinesRe;

// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
/** @typedef {import("markdownlint").RuleOnError} RuleOnError */
/** @typedef {import("../lib/exports.mjs").RuleOnError} RuleOnError */
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
/** @typedef {import("markdownlint").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
/** @typedef {import("../lib/exports.mjs").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
/** @typedef {import("markdownlint").MicromarkToken} MicromarkToken */
/** @typedef {import("../lib/exports.mjs").MicromarkToken} MicromarkToken */
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("micromark-extension-gfm-footnote", { with: { "resolution-mode": "import" } })} */
// eslint-disable-next-line jsdoc/valid-types
Expand Down
2 changes: 1 addition & 1 deletion helpers/micromark-helpers.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { flatTokensSymbol, htmlFlowSymbol } = require("./shared.cjs");
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("micromark-util-types", { with: { "resolution-mode": "import" } }).TokenType} TokenType */
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
/** @typedef {import("markdownlint").MicromarkToken} Token */
/** @typedef {import("../lib/exports.mjs").MicromarkToken} Token */

/**
* Determines if a Micromark token is within an htmlFlow type.
Expand Down
1 change: 1 addition & 0 deletions lib/types.d.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export {};
declare module "markdownlint" {
export * from "./exports.mjs";
}
Expand Down

0 comments on commit 8b26129

Please sign in to comment.