diff --git a/docs/examples/show-count.tsx b/docs/examples/show-count.tsx index 91be3a2..8d1be49 100644 --- a/docs/examples/show-count.tsx +++ b/docs/examples/show-count.tsx @@ -40,8 +40,7 @@ const Demo: FC = () => { count={{ show: true, max: 5, - strategy: (val) => - [...new (Intl as any).Segmenter().segment(val)].length, + strategy: (val) => [...new Intl.Segmenter().segment(val)].length, }} />

Customize exceedFormatter

@@ -53,7 +52,7 @@ const Demo: FC = () => { show: true, max: 5, exceedFormatter: (val, { max }) => { - const segments = [...new (Intl as any).Segmenter().segment(val)]; + const segments = [...new Intl.Segmenter().segment(val)]; return segments .filter((seg) => seg.index + seg.segment.length <= max) diff --git a/src/interface.ts b/src/interface.ts index ecb4b7a..736bfaa 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -114,7 +114,7 @@ export interface InputProps string >; onPressEnter?: KeyboardEventHandler; - /** @deprecated Use `count` instead */ + /** @deprecated Use `count.show` instead */ showCount?: | boolean | { diff --git a/tests/count.test.tsx b/tests/count.test.tsx index 9975b8f..2f3ca0e 100644 --- a/tests/count.test.tsx +++ b/tests/count.test.tsx @@ -2,9 +2,7 @@ import { fireEvent, render } from '@testing-library/react'; import React from 'react'; import Input from '../src'; -const getSegments = (val: string) => [ - ...new (Intl as any).Segmenter().segment(val), -]; +const getSegments = (val: string) => [...new Intl.Segmenter().segment(val)]; describe('Input.Count', () => { it('basic emoji take length', () => { diff --git a/tsconfig.json b/tsconfig.json index f8e6324..540895d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "module": "ESNext", "moduleResolution": "node", "baseUrl": "./", - "lib": ["dom", "es2017"], + "lib": ["dom", "es2017", "es2022"], "jsx": "react", "strict": true, "esModuleInterop": true,