While implementing cleave.js for credit card formatting of an input field created as a custom element using litElement I ran into this error when I type the first character into the input but no issue with subsequent characters.
cleave-esm.js:712 Uncaught TypeError: Cannot read property 'slice' of undefined
at Object.getPostDelimiter (cleave-esm.js:712)
at Cleave.onChange (cleave-esm.js:1244)
I tracked it down as far as that it seems getPostDelimiter() is taking a value that is the previous character typed. Since I am looking at the first character this function fails when it tries to execute cleave-esm.js:712.
return value.slice(-delimiter.length) === delimiter ? delimiter : '';
I'm not sure if there is something I can do in my implementation to resolve this or if it's just a bug in Cleave.js that needs to be fixed.