Add null return types to BlockRenderer and defaultBlockTag#201
Open
pereznieto wants to merge 2 commits intosstur:masterfrom
Open
Add null return types to BlockRenderer and defaultBlockTag#201pereznieto wants to merge 2 commits intosstur:masterfrom
BlockRenderer and defaultBlockTag#201pereznieto wants to merge 2 commits intosstur:masterfrom
Conversation
This was referenced Nov 14, 2019
shpyo
reviewed
Oct 14, 2022
| type BlockStyleFn = (block: draftjs.ContentBlock) => RenderConfig|undefined; | ||
| type EntityStyleFn = (entity: draftjs.EntityInstance) => RenderConfig|undefined; | ||
| type BlockRenderer = (block: draftjs.ContentBlock) => string; | ||
| type BlockRenderer = (block: draftjs.ContentBlock) => string|null|undefined; |
There was a problem hiding this comment.
Suggested change
| type BlockRenderer = (block: draftjs.ContentBlock) => string|null|undefined; | |
| type BlockRenderer = (block: draftjs.ContentBlock) => ?string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds two
nulltypes to the TypeScript definition ofdraft-js-export-html:BlockRendereranddefaultBlockTag.These
nullreturn types are present in the documentation (and code), but were missing from the TypeScript definition, thus causing type linting/compilation errors.I decided to combine both changes in a single PR, as the changes are small and simple enough and touch the same file.
Changes
BlockRendererThe docs state:
The possibility to return
nullorundefinedwas missing from the TypeScript definition, meaning it wasn't possible to defer to the default renderer in aBlockRendererfunction.defaultBlockTagThe docs state:
The TypeScript definition didn't allow for this, as it required a
stringto be returned.Related issues
BlockRenderer: BlockRenderer type can be null #132defaultBlockTag: defaultBlockTag type can accept null #197