mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Add types for draftjs-to-html (#38588)
* Add types for draftjs-to-html * Add types for draftjs-to-html: remove excess blank line * Add types for draftjs-to-html: change function export
This commit is contained in:
committed by
Ben Lichtman
parent
a9c67da719
commit
99078a21ed
@@ -0,0 +1,21 @@
|
||||
import draftToHtml from 'draftjs-to-html';
|
||||
|
||||
const editorContent = {
|
||||
blocks: [
|
||||
{
|
||||
key: '355iu',
|
||||
text: 'test',
|
||||
type: 'unstyled',
|
||||
depth: 0,
|
||||
inlineStyleRanges: [],
|
||||
entityRanges: [],
|
||||
data: {
|
||||
'text-align': 'center',
|
||||
},
|
||||
},
|
||||
],
|
||||
entityMap: {},
|
||||
};
|
||||
|
||||
// $ExpectType string
|
||||
draftToHtml(editorContent);
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for draftjs-to-html 0.8
|
||||
// Project: https://github.com/jpuri/draftjs-to-html#readme
|
||||
// Definitions by: Ivan Zverev <https://github.com/1cheese>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { RawDraftContentState } from 'draft-js';
|
||||
|
||||
interface HashtagConfig {
|
||||
trigger?: string;
|
||||
separator?: string;
|
||||
}
|
||||
|
||||
declare function draftToHtml(
|
||||
editorContent: RawDraftContentState,
|
||||
hashtagConfig?: HashtagConfig,
|
||||
directional?: boolean,
|
||||
customEntityTransform?: (...args: any[]) => any,
|
||||
): string;
|
||||
|
||||
export = draftToHtml;
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"draftjs-to-html-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user