mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Fix cleave.js (Cleave is a class, not a function) (#23046)
* Fix cleave.js (Cleave is a class, not a function) See examples at https://github.com/nosir/cleave.js * Add whitespace
This commit is contained in:
parent
5e86d4b159
commit
09bc77ae3d
@ -3,7 +3,12 @@ import Cleave = require("cleave.js");
|
||||
import CleaveReact = require("cleave.js/react");
|
||||
|
||||
const Example1 = () => {
|
||||
Cleave("#my-input", { phone: true });
|
||||
const cleave = new Cleave("#my-input", { phone: true });
|
||||
cleave.setPhoneRegionCode("AT");
|
||||
cleave.setRawValue("foo");
|
||||
const foo: string = cleave.getFormattedValue();
|
||||
const bar: string = cleave.getRawValue();
|
||||
cleave.destroy();
|
||||
};
|
||||
|
||||
const ExampleReact1 = (props: any) => {
|
||||
|
||||
15
types/cleave.js/index.d.ts
vendored
15
types/cleave.js/index.d.ts
vendored
@ -6,5 +6,18 @@
|
||||
|
||||
import { CleaveOptions } from './options';
|
||||
|
||||
declare function Cleave(selector: string, options: CleaveOptions): void;
|
||||
declare class Cleave {
|
||||
constructor(selector: string, options: CleaveOptions);
|
||||
|
||||
getRawValue(): string;
|
||||
|
||||
setRawValue(value: string): void;
|
||||
|
||||
getFormattedValue(): string;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
setPhoneRegionCode(regionCode: string): void;
|
||||
}
|
||||
|
||||
export = Cleave;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user