Added typings for the package markdown-draft-js (#43041)

This commit is contained in:
Yuri Drabik 2020-03-15 03:23:57 +01:00 committed by GitHub
parent c9500ceeca
commit af165fc771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 0 deletions

11
types/markdown-draft-js/index.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
// Type definitions for markdown-draft-js 2.2
// Project: https://github.com/Rosey/markdown-draft-js#readme
// Definitions by: Yuri Drabik <https://github.com/yurist38>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import { RawDraftContentState } from 'draft-js';
export function markdownToDraft(markdown: string): RawDraftContentState;
export function draftToMarkdown(RawDraft: RawDraftContentState): string;

View File

@ -0,0 +1,8 @@
import { EditorState, convertToRaw, convertFromRaw } from 'draft-js';
import { draftToMarkdown, markdownToDraft } from 'markdown-draft-js';
const rawContent = convertToRaw(EditorState.createEmpty().getCurrentContent());
draftToMarkdown(rawContent);
const rawDraft = markdownToDraft('# Test');
convertFromRaw(rawDraft);

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"markdown-draft-js-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }