I defined editorStyleMap and use them
const editorStyleMap = { Choose: { color: '#4880f0' }, Black: { color: '#000000' } }
then I get the array of inlineStyleRanges
const messageBlocks=convertToRaw(editorState.getCurrentContent()).blocks[0].inlineStyleRanges;
i console every item of the array and the result is below, item's style can be 'Choose' or 'Black'
{offset: 3, length: 3, style: 'Choose'} {offset: 6, length: 5, style: 'Black'} {offset: 11, length: 3, style: 'Choose'} {offset: 14, length: 1, style: 'Black'}
but when i want to use if to judge the type of style
if(item.style==='Choose')
terminal reports an error
'This condition will always return 'false' since the types 'DraftInlineStyleType' and '"Choose"' have no overlap.'
it seems that styleType only can be default type like 'BOLD' and 'ITALIC'.
i don't know why??? if you could help me, i would be grateful:)
i use a strange way to solve the problem. just use String() method to convert item.style to string type, and the string can be anything you define
if(String(item.style)==='Choose')
The terminal does not report an error