chore: remove the subtype, and remove inputtype from number

This commit is contained in:
BluJ
2023-04-03 13:05:15 -06:00
parent 510074530f
commit 0f79f71dd2
3 changed files with 3 additions and 23 deletions

View File

@@ -4,12 +4,6 @@ import { List } from "./list";
import { Value } from "./value";
import { Variants } from "./variants";
describe("test", () => {
test("test", () => {
expect(true).toEqual(true);
});
});
describe("builder tests", () => {
test("String", () => {
const bitcoinPropertiesBuilt: {

View File

@@ -1,12 +1,6 @@
import { BuilderExtract, IBuilder } from "./builder";
import { Config } from "./config";
import {
InputSpec,
ListValueSpecNumber,
ListValueSpecString,
UniqueBy,
ValueSpecList,
} from "../config-types";
import { InputSpec, ListValueSpecNumber, ListValueSpecString, UniqueBy, ValueSpecList } from "../config-types";
import { guardAll } from "../../util";
/**
* Used as a subtype of Value.list
@@ -77,8 +71,6 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
range?: string;
units?: string | null;
placeholder?: string | null;
/** Default = 'numeric */
inputmode?: "numeric" | "decimal";
}
) {
const spec = {
@@ -86,7 +78,6 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
placeholder: null,
range: "(*,*)",
units: null,
inputmode: "numeric" as const,
...aSpec,
};
return new List({

View File

@@ -111,8 +111,7 @@ export type ListValueSpecOf<T extends ListValueSpecType> = T extends "string"
/** represents a spec for a list */
export type ValueSpecList = ValueSpecListOf<ListValueSpecType>;
export interface ValueSpecListOf<T extends ListValueSpecType>
extends WithStandalone {
export interface ValueSpecListOf<T extends ListValueSpecType> extends WithStandalone {
type: "list";
spec: ListValueSpecOf<T>;
range: string; // '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules
@@ -128,10 +127,7 @@ export interface ValueSpecListOf<T extends ListValueSpecType>
}
// sometimes the type checker needs just a little bit of help
export function isValueSpecListOf<S extends ListValueSpecType>(
t: ValueSpecList,
s: S
): t is ValueSpecListOf<S> {
export function isValueSpecListOf<S extends ListValueSpecType>(t: ValueSpecList, s: S): t is ValueSpecListOf<S> {
return t.spec.type === s;
}
@@ -150,7 +146,6 @@ export interface ListValueSpecNumber {
range: string;
integral: boolean; // default = false
units: string | null;
inputmode: "numeric" | "decimal"; // default = 'decimal'
placeholder: string | null;
}