Skip to content

Commit

Permalink
remove ts-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
uNmAnNeR committed Jun 21, 2023
1 parent c16f160 commit 6a8ed42
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/imask/src/masked/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ abstract class Masked<Value=any> {
declare commit?: (value: string, masked: this) => void;
/** Format typed value to string */
declare format?: (value: Value, masked: this) => string;
/** Parse strgin to get typed value */
/** Parse string to get typed value */
declare parse?: (str: string, masked: this) => Value;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
abstract overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
abstract eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;
abstract skipInvalid?: boolean | undefined;

/** */
declare _initialized: boolean;
Expand Down
3 changes: 0 additions & 3 deletions packages/imask/src/masked/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ class MaskedDynamic<Value=any> extends Masked<Value> {
super.nearestInputPos(cursorPos, direction);
}

// @ts-ignore i don't mind overriding
override get overwrite (): boolean | 'shift' | undefined {
return this.currentMask ?
this.currentMask.overwrite :
Expand All @@ -309,7 +308,6 @@ class MaskedDynamic<Value=any> extends Masked<Value> {
this._overwrite = overwrite;
}

// @ts-ignore i don't mind overriding
override get eager (): boolean | 'remove' | 'append' | undefined {
return this.currentMask ?
this.currentMask.eager :
Expand All @@ -320,7 +318,6 @@ class MaskedDynamic<Value=any> extends Masked<Value> {
this._eager = eager;
}

// @ts-ignore i don't mind overriding
override get skipInvalid (): boolean | undefined {
return this.currentMask ?
this.currentMask.skipInvalid :
Expand Down
7 changes: 7 additions & 0 deletions packages/imask/src/masked/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ type MaskedFunctionOptions = MaskedOptions<MaskedFunction>;
/** Masking by custom Function */
export default
class MaskedFunction<Value=any> extends Masked<Value> {
/** */
declare mask: (value: string, masked: this) => boolean;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;

override updateOptions (opts: Partial<MaskedFunctionOptions>) {
super.updateOptions(opts);
Expand Down
6 changes: 6 additions & 0 deletions packages/imask/src/masked/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ class MaskedNumber extends Masked<number> {
declare normalizeZeros: boolean;
/** Flag to pad trailing zeros after point in the end of editing */
declare padFractionalZeros: boolean;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;

declare _numberRegExp: RegExp;
declare _thousandsSeparatorRegExp: RegExp;
Expand Down
6 changes: 6 additions & 0 deletions packages/imask/src/masked/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class MaskedPattern<Value=string> extends Masked<Value> {
declare displayChar: string;
/** Show placeholder only when needed */
declare lazy: boolean;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;

declare _blocks: Array<PatternBlock>;
declare _maskedBlocks: {[key: string]: Array<number>};
Expand Down
7 changes: 7 additions & 0 deletions packages/imask/src/masked/regexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ type MaskedRegExpOptions = MaskedOptions<MaskedRegExp>;
/** Masking by RegExp */
export default
class MaskedRegExp extends Masked<string> {
/** */
declare mask: RegExp;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;

override updateOptions (opts: Partial<MaskedRegExpOptions>) {
super.updateOptions(opts);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-imask/src/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const MASK_PROPS: { [key in keyof (AllFactoryStaticOpts & ReactMaskProps<InputMa
PropTypes.string,
PropTypes.instanceOf(RegExp),
PropTypes.oneOf([Date, Number, IMask.Masked]),
PropTypes.instanceOf(IMask.Masked),
PropTypes.instanceOf(IMask.Masked as any),
]),
value: PropTypes.any,
unmask: PropTypes.oneOfType([
Expand Down

0 comments on commit 6a8ed42

Please sign in to comment.