mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added typings for the package markdown-draft-js (#43041)
This commit is contained in:
parent
c9500ceeca
commit
af165fc771
11
types/markdown-draft-js/index.d.ts
vendored
Normal file
11
types/markdown-draft-js/index.d.ts
vendored
Normal 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;
|
||||
8
types/markdown-draft-js/markdown-draft-js-tests.ts
Normal file
8
types/markdown-draft-js/markdown-draft-js-tests.ts
Normal 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);
|
||||
24
types/markdown-draft-js/tsconfig.json
Normal file
24
types/markdown-draft-js/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/markdown-draft-js/tslint.json
Normal file
1
types/markdown-draft-js/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user