diff --git a/types/alex/alex-tests.ts b/types/alex/alex-tests.ts index 85055c7fff..bbf0f3253e 100644 --- a/types/alex/alex-tests.ts +++ b/types/alex/alex-tests.ts @@ -1,3 +1,5 @@ +import alex = require('alex'); + // configs const exemption = ['word', 'noun']; const deny = ['deny', 'word']; @@ -18,15 +20,22 @@ alex('We’ve confirmed his identity.'); // $ExpectType VFile alex('We’ve confirmed his identity.', exemption); // $ExpectType VFile alex('We’ve confirmed his identity.', config); // $ExpectType VFile alex('We’ve confirmed his identity.', denyConfig); // $ExpectType VFile + alex.markdown('### We’ve confirmed his **identity**.'); // $ExpectType VFile alex.markdown('### We’ve confirmed his **identity**.', exemption); // $ExpectType VFile alex.markdown('### We’ve confirmed his **identity**.', config); // $ExpectType VFile alex.markdown('### We’ve confirmed his **identity**.', denyConfig); // $ExpectType VFile + alex.html('

He walked to class.

'); // $ExpectType VFile alex.html('

He walked to class.

', exemption); // $ExpectType VFile alex.html('

He walked to class.

', config); // $ExpectType VFile alex.html('

He walked to class.

', denyConfig); // $ExpectType VFile + alex.text('The `boogeyman`.'); // $ExpectType VFile alex.text('The `boogeyman`.', exemption); // $ExpectType VFile alex.text('The `boogeyman`.', config); // $ExpectType VFile alex.text('The `boogeyman`.', denyConfig); // $ExpectType VFile + +alex.mdx('The `boogeyman`.', denyConfig); // $ExpectType VFile +alex.mdx('He walked to class.'); // $ExpectType VFile +alex.mdx('He walked to class.', config); // $ExpectType VFile diff --git a/types/alex/index.d.ts b/types/alex/index.d.ts index e9c05a42ff..9bd462819b 100644 --- a/types/alex/index.d.ts +++ b/types/alex/index.d.ts @@ -1,14 +1,14 @@ -// Type definitions for alex 8.2 +// Type definitions for alex 9.0 // Project: https://alexjs.com // Definitions by: Piotr Błażejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as vfile from 'vfile'; +import { VFile } from 'vfile'; /** * finds gender favoring, polarizing, race related, religion inconsiderate, or other unequal phrasing in text. */ -declare function alex(value: vfile.VFile | string, config?: alex.Config): vfile.VFile; +declare function alex(value: VFile | string, config?: alex.Config): VFile; declare namespace alex { /** @@ -38,13 +38,21 @@ declare namespace alex { } /** Check Markdown (ignoring syntax). */ - function markdown(value: vfile.VFile | string, config?: Config): vfile.VFile; + function markdown(value: VFile | string, config?: Config): VFile; /** Check HTML (ignoring syntax). */ - function html(value: vfile.VFile | string, config?: Config): vfile.VFile; + function html(value: VFile | string, config?: Config): VFile; /** Check plain text (as in, syntax is checked). */ - function text(value: vfile.VFile | string, config?: Config): vfile.VFile; + function text(value: VFile | string, config?: Config): VFile; + + /** + * Check [MDX][] (ignoring syntax). + * + * Note: the syntax for [MDX@2][mdx-next], while currently in beta, is used in + * alex + */ + function mdx(value: VFile | string, config?: Config): VFile; } export as namespace alex; diff --git a/types/alex/package.json b/types/alex/package.json index 421554df5b..362fa2e5ed 100644 --- a/types/alex/package.json +++ b/types/alex/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "vfile": "^4.0.2" + "vfile": "^4.2.0" } }