mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for html-to-draftjs (#38592)
This commit is contained in:
parent
3c9854f984
commit
05ce01bbe4
9
types/html-to-draftjs/html-to-draftjs-tests.ts
Normal file
9
types/html-to-draftjs/html-to-draftjs-tests.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import htmlToDraft from 'html-to-draftjs';
|
||||
import { ContentBlock } from 'draft-js';
|
||||
|
||||
const blocksFromHtml = htmlToDraft('<p>test</p>');
|
||||
|
||||
// $ExpectType ContentBlock[]
|
||||
const contentBlocks = blocksFromHtml.contentBlocks;
|
||||
// $ExpectType any
|
||||
const entityMap = blocksFromHtml.entityMap;
|
||||
17
types/html-to-draftjs/index.d.ts
vendored
Normal file
17
types/html-to-draftjs/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for html-to-draftjs 1.4
|
||||
// Project: https://github.com/jpuri/html-to-draftjs#readme
|
||||
// Definitions by: Ivan Zverev <https://github.com/1cheese>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { ContentBlock, RawDraftEntity } from 'draft-js';
|
||||
|
||||
export default function htmlToDraft(
|
||||
text: string,
|
||||
customChunkRenderer?: (
|
||||
nodeName: string, node: HTMLElement
|
||||
) => RawDraftEntity | undefined,
|
||||
): {
|
||||
contentBlocks: ContentBlock[];
|
||||
entityMap?: any;
|
||||
};
|
||||
24
types/html-to-draftjs/tsconfig.json
Normal file
24
types/html-to-draftjs/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"html-to-draftjs-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/html-to-draftjs/tslint.json
Normal file
1
types/html-to-draftjs/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user