Skip to content

Commit

Permalink
chore: adjust ts (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Sep 27, 2023
1 parent 1938624 commit 93b77ba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions docs/examples/show-count.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}}
/>
<h4 style={sharedHeadStyle}>Customize exceedFormatter</h4>
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export interface InputProps
string
>;
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
/** @deprecated Use `count` instead */
/** @deprecated Use `count.show` instead */
showCount?:
| boolean
| {
Expand Down
4 changes: 1 addition & 3 deletions tests/count.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"module": "ESNext",
"moduleResolution": "node",
"baseUrl": "./",
"lib": ["dom", "es2017"],
"lib": ["dom", "es2017", "es2022"],
"jsx": "react",
"strict": true,
"esModuleInterop": true,
Expand Down

0 comments on commit 93b77ba

Please sign in to comment.