mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #34620 from adriankremer/master
[rehype-react] Add initial type definitions
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for rehype-react 3.1
|
||||
// Project: https://github.com/rhysd/rehype-react
|
||||
// Definitions by: Adrian Kremer <https://github.com/adriankremer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
interface Options {
|
||||
createElement: typeof React.createElement;
|
||||
components: {
|
||||
[tagName: string]: React.ComponentType<any>;
|
||||
};
|
||||
prefix?: string;
|
||||
}
|
||||
|
||||
declare class RehypeReact {
|
||||
constructor(options: Options)
|
||||
Compiler: (node: any) => any;
|
||||
}
|
||||
|
||||
export = RehypeReact;
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from "react";
|
||||
import RehypeReact from "rehype-react";
|
||||
|
||||
const htmlAst = {
|
||||
type: "element",
|
||||
tagName: "button"
|
||||
};
|
||||
|
||||
const { Compiler: compile } = new RehypeReact({
|
||||
createElement: React.createElement,
|
||||
components: {
|
||||
button: () => {
|
||||
return <button />;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
compile(htmlAst);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": ["index.d.ts", "rehype-react-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user