Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types: add types to test utils (#1083)
- Loading branch information
1 parent
e2eb4ee
commit a3d8f08
Showing
6 changed files
with
51 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,13 @@ | ||
// TypeScript Version: 3.4 | ||
|
||
import {ParseResult} from '@babel/core' | ||
import {ComponentType} from 'react' | ||
|
||
export function parse(code: string): ParseResult | ||
export function tranform(code: string): string | ||
export function renderWithReact( | ||
code: string, | ||
components?: { | ||
[name: string]: ComponentType<any> | ||
} | ||
): Promise<string> |
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,7 @@ | ||
import * as React from 'react' | ||
import {parse, tranform, renderWithReact} from '@mdx-js/test-util' | ||
|
||
parse('') // $ExpectType ParseResult | ||
tranform('') // $ExpectType string | ||
renderWithReact('') // $ExpectType Promise<string> | ||
renderWithReact('', {a: () => <></>}) // $ExpectType Promise<string> |
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": ["dom", "es6"], | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"baseUrl": ".", | ||
"jsx": "react", | ||
"paths": { | ||
"@mdx-js/test-util": ["index.d.ts"] | ||
} | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"extends": "dtslint/dtslint.json", | ||
"rules": { | ||
"whitespace": false, | ||
"semicolon": false | ||
} | ||
} |
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