TextSelection fails

After upgrading the prosemirror-state to a particuler version(“1.4.2”), facing issue while checking the condition if(selection instanceof TextSelection), This condition never satisfies even if the selection is a TextSelection. if ( selection instanceof TextSelection && prevState.selection instanceof TextSelection ) { const currentPos = selection.$cursor ? selection.$cursor.pos : selection.$to.pos; const para = findParentNodeClosestToPos( nextState.doc.resolve(currentPos), (node) => { return node.type === schema.nodes.paragraph; } );

Any help is appreciated. Thanks in advance.

Check if your npm ended up installing multiple versions of prosemirror packages (it likes to do that when you upgrade). If it did, resolve it by removing your package lock and reinstalling your dependencies.