-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to correctly compile intrinsic types
Reviewed-by: Remco Haszing <remcohaszing@gmail.com> Reviewed-by: Titus Wormer <tituswormer@gmail.com> Related to GH-31.
- Loading branch information
1 parent
28c6279
commit dac20e2
Showing
3 changed files
with
45 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
coverage/ | ||
node_modules/ | ||
.DS_Store | ||
lib/index.d.ts | ||
lib/*.d.ts | ||
test.d.ts | ||
*.log | ||
yarn.lock |
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,43 @@ | ||
import type {ComponentType} from 'react' | ||
import type {Element} from 'hast' | ||
|
||
interface WithNode { | ||
node: Element | ||
} | ||
|
||
export interface ComponentsWithNodeOptions { | ||
/** | ||
* Expose hast elements as a `node` field in components | ||
*/ | ||
passNode: true | ||
/** | ||
* Override default elements (such as `<a>`, `<p>`, etcetera) by passing an | ||
* object mapping tag names to components. | ||
*/ | ||
components?: Partial< | ||
{ | ||
[TagName in keyof JSX.IntrinsicElements]: | ||
| keyof JSX.IntrinsicElements | ||
| ComponentType<WithNode & JSX.IntrinsicElements[TagName]> | ||
} | ||
> | ||
} | ||
|
||
export interface ComponentsWithoutNodeOptions { | ||
/** | ||
* Expose hast elements as a `node` field in components. | ||
*/ | ||
passNode?: false | undefined | ||
|
||
/** | ||
* Override default elements (such as `<a>`, `<p>`, etcetera) by passing an | ||
* object mapping tag names to components. | ||
*/ | ||
components?: Partial< | ||
{ | ||
[TagName in keyof JSX.IntrinsicElements]: | ||
| keyof JSX.IntrinsicElements | ||
| ComponentType<JSX.IntrinsicElements[TagName]> | ||
} | ||
> | ||
} |
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