-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add type definitions file (#212)
- Loading branch information
1 parent
36d7b96
commit b474b16
Showing
6 changed files
with
126 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export interface Options { | ||
/** | ||
* The {@link https://docusaurus.io/docs/markdown-features/tabs#syncing-tab-choices | `groupId`} | ||
* property for all instances of `Tabs` component created by this plugin. | ||
*/ | ||
groupId?: string; | ||
/** | ||
* List with tuples with code block language attribute and tab label text. | ||
*/ | ||
labels?: Array<[string, string]>; | ||
/** | ||
* Whether tab choices should be {@link https://docusaurus.io/docs/markdown-features/tabs#syncing-tab-choices | synced} | ||
* between all tabs created by this plugin. | ||
*/ | ||
sync?: boolean; | ||
} | ||
|
||
/** | ||
* Turns Docusaurus {@link https://docusaurus.io/docs/next/markdown-features/code-blocks | code blocks} | ||
* into {@link https://docusaurus.io/docs/next/markdown-features/tabs | tabs}. | ||
*/ | ||
declare function tabBlocks(options?: Options): void; | ||
|
||
export default tabBlocks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,15 +20,18 @@ | |
}, | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "index.js", | ||
"exports": { | ||
".": "./index.js" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"scripts": { | ||
"lint": "yarn lint:eslint && yarn lint:prettier", | ||
"lint:eslint": "eslint . --ext js", | ||
"lint:prettier": "prettier . --no-config --write", | ||
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest" | ||
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest", | ||
"test:types": "tstyche" | ||
}, | ||
"dependencies": { | ||
"unist-util-is": "^6.0.0", | ||
|
@@ -41,7 +44,9 @@ | |
"jest": "29.7.0", | ||
"prettier": "3.1.0", | ||
"remark": "15.0.1", | ||
"remark-mdx": "3.0.0" | ||
"remark-mdx": "3.0.0", | ||
"tstyche": "1.0.0-beta.3", | ||
"typescript": "5.2.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2022", | ||
"module": "node16", | ||
"moduleResolution": "node16", | ||
|
||
// "allowJs": true, | ||
// "checkJs": true, | ||
|
||
"noEmit": true, | ||
|
||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
|
||
"strict": true, | ||
"allowUnreachableCode": false, | ||
"exactOptionalPropertyTypes": true, | ||
"noImplicitReturns": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noUncheckedIndexedAccess": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
|
||
"skipLibCheck": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { expect, test } from "tstyche"; | ||
import tabBlocks, { type Options } from "docusaurus-remark-plugin-tab-blocks"; | ||
|
||
const options: Options = {}; | ||
|
||
test("tabBlocks()", () => { | ||
expect(tabBlocks()).type.toBeVoid(); | ||
expect(tabBlocks(options)).type.toBeVoid(); | ||
}); | ||
|
||
test("Options", () => { | ||
expect(options).type.toBeAssignable({ groupId: "code-examples" }); | ||
expect(options).type.toBeAssignable({ | ||
labels: [ | ||
["js", "JavaScript"] as [string, string], | ||
["ts", "TypeScript"] as [string, string], | ||
], | ||
}); | ||
expect(options).type.toBeAssignable({ sync: true }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters