Add generic to util holders to reduce manual type casting
This commit is contained in:
parent
622885767d
commit
3ee7f1d5ff
14
src/utils.ts
14
src/utils.ts
|
@ -298,22 +298,22 @@ export class BooleanHolder {
|
|||
}
|
||||
}
|
||||
|
||||
export class NumberHolder {
|
||||
public value: number;
|
||||
export class NumberHolder<T = number> {
|
||||
public value: T;
|
||||
|
||||
constructor(value: number) {
|
||||
constructor(value: T) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
export class IntegerHolder extends NumberHolder {
|
||||
constructor(value: integer) {
|
||||
export class IntegerHolder<T = integer> extends NumberHolder<T> {
|
||||
constructor(value: T) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
|
||||
export class FixedInt extends IntegerHolder {
|
||||
constructor(value: integer) {
|
||||
export class FixedInt<T = integer> extends IntegerHolder<T> {
|
||||
constructor(value: T) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue