ITADN

'postProcess' does not exist in type 'MaskOptions'.

#270Closed9mm 创建于 2025-07-20
9
9mmcommented
``` Diagnostics: 1. Object literal may only specify known properties, and 'postProcess' does not exist in type 'MaskOptions'. ``` It appears the types are out of date or something, as postProcess definitely works, but I am getting TS errors ``` export const currency = bindMask({ number: { locale: "en-US", fraction: 2, unsigned: true, }, postProcess: (v: string) => v ? `$${v}` : v, }); export const bindMask = (options: MaskOptions): Masker => { return (target) => { if (!(target instanceof HTMLInputElement)) { throw new Error("Maska target must be a <base-input> element"); } // remove double firing of maska input events target.dataset.mask = "true"; const swallowMaska = (e: Event) => { if (e.isTrusted) return; if ((e.target as HTMLElement).dataset.mask) { e.stopPropagation(); } }; target.addEventListener("input", swallowMaska, { capture: true }); return new MaskInput(target, options); }; }; ```
关闭于 2025-07-20 1 条评论