Skip to content

Commit

Permalink
Munge type reference comments onto index.d.ts
Browse files Browse the repository at this point in the history
Having them in index.js isn't enough - they have to be in index.d.ts. I
can't find a nice way to get them to appear there, so here's a not very
nice way of doing it.
  • Loading branch information
richardTowers committed Sep 17, 2024
1 parent a665496 commit 9978e11
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.d.ts
!**/types/index.d.ts
!/dev/type-references.d.ts
*.log
/node_modules
/.vscode
Expand Down
3 changes: 0 additions & 3 deletions dev/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="./lib/mdast-util-abbr/types/index.js" />
/// <reference types="./lib/micromark-extension-abbr/types/index.js" />

/** @import { Processor } from "unified" */
import {abbr} from './lib/micromark-extension-abbr/syntax.js'
import {abbrFromMarkdown} from './lib/mdast-util-abbr/index.js'
Expand Down
2 changes: 2 additions & 0 deletions dev/type-references.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="./lib/mdast-util-abbr/types/index.js" />

Check failure on line 1 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / lts/hydrogen

Do not use a triple slash reference for ./lib/mdast-util-abbr/types/index.js, use `import` style instead.

Check failure on line 1 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / lts/iron

Do not use a triple slash reference for ./lib/mdast-util-abbr/types/index.js, use `import` style instead.

Check failure on line 1 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / node

Do not use a triple slash reference for ./lib/mdast-util-abbr/types/index.js, use `import` style instead.
/// <reference types="./lib/micromark-extension-abbr/types/index.js" />

Check failure on line 2 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / lts/hydrogen

Do not use a triple slash reference for ./lib/micromark-extension-abbr/types/index.js, use `import` style instead.

Check failure on line 2 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / lts/iron

Do not use a triple slash reference for ./lib/micromark-extension-abbr/types/index.js, use `import` style instead.

Check failure on line 2 in dev/type-references.d.ts

View workflow job for this annotation

GitHub Actions / node

Do not use a triple slash reference for ./lib/micromark-extension-abbr/types/index.js, use `import` style instead.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"index.d.ts"
],
"scripts": {
"build": "tsc --build --clean && tsc --build && type-coverage && micromark-build",
"build": "tsc --build --clean && tsc --build && type-coverage && micromark-build && npm run munge-type-references",
"munge-type-references": "cat type-references.d.ts index.d.ts > tmp.d.ts && mv tmp.d.ts index.d.ts && rm type-references.d.ts",
"format": "prettier . -w --log-level warn && xo --fix",
"test-dev": "node --conditions development --test",
"test-prod": "node --conditions production --test",
Expand Down

0 comments on commit 9978e11

Please sign in to comment.