From fa2d9367c684f90d00b84accc4757b142eeb882f Mon Sep 17 00:00:00 2001 From: BluJ Date: Sat, 25 Mar 2023 18:35:14 -0600 Subject: [PATCH] chore: Update to docstrings --- lib/types/config-types.ts | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/types/config-types.ts b/lib/types/config-types.ts index b57a521..c75d8ed 100644 --- a/lib/types/config-types.ts +++ b/lib/types/config-types.ts @@ -12,7 +12,7 @@ export type ValueType = | "union"; export type ValueSpec = ValueSpecOf; -// core spec types. These types provide the metadata for performing validations +/** core spec types. These types provide the metadata for performing validations */ export type ValueSpecOf = T extends "string" ? ValueSpecString : T extends "number" @@ -53,7 +53,8 @@ export interface ValueSpecSelect extends SelectBase, WithStandalone { export interface ValueSpecMultiselect extends SelectBase, WithStandalone { type: "multiselect"; - range: string; // '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules + /**'[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules */ + range: string; default: string[]; } @@ -70,7 +71,7 @@ export interface ValueSpecUnion { } export interface ValueSpecFile extends WithStandalone { - type: 'file'; + type: "file"; placeholder: null | string; nullable: boolean; extensions: string[]; @@ -92,14 +93,10 @@ export interface SelectBase { "value-names": { [value: string]: string }; } -// no lists of booleans, lists -export type ListValueSpecType = - | "string" - | "number" - | "object" - | "union"; +/** no lists of booleans, lists*/ +export type ListValueSpecType = "string" | "number" | "object" | "union"; -// represents a spec for the values of a list +/** represents a spec for the values of a list */ export type ListValueSpecOf = T extends "string" ? ListValueSpecString : T extends "number" @@ -110,10 +107,9 @@ export type ListValueSpecOf = T extends "string" ? ListValueSpecUnion : never; -// represents a spec for a list +/** represents a spec for a list */ export type ValueSpecList = ValueSpecListOf; -export interface ValueSpecListOf - extends WithStandalone { +export interface ValueSpecListOf extends WithStandalone { type: "list"; subtype: T; spec: ListValueSpecOf; @@ -130,10 +126,7 @@ export interface ValueSpecListOf } // sometimes the type checker needs just a little bit of help -export function isValueSpecListOf( - t: ValueSpecList, - s: S -): t is ValueSpecListOf { +export function isValueSpecListOf(t: ValueSpecList, s: S): t is ValueSpecListOf { return t.subtype === s; } @@ -145,16 +138,20 @@ export interface ListValueSpecString { } export interface ListValueSpecNumber { - range: string; // '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules + /** '[0,1]' (inclusive) OR '[0,*)' (right unbounded), normal math rules */ + range: string; integral: boolean; units: null | string; placeholder: null | string; } export interface ListValueSpecObject { - spec: InputSpec; // this is a mapped type of the config object at this level, replacing the object's values with specs on those values - "unique-by": UniqueBy; // indicates whether duplicates can be permitted in the list - "display-as": null | string; // this should be a handlebars template which can make use of the entire config which corresponds to 'spec' + /** this is a mapped type of the config object at this level, replacing the object's values with specs on those values */ + spec: InputSpec; + /** indicates whether duplicates can be permitted in the list */ + "unique-by": UniqueBy; + /** this should be a handlebars template which can make use of the entire config which corresponds to 'spec' */ + "display-as": null | string; } export type UniqueBy = @@ -167,15 +164,18 @@ export type UniqueBy = export interface ListValueSpecUnion { tag: UnionTagSpec; variants: { [key: string]: InputSpec }; - "display-as": null | string; // this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id + /** this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id*/ + "display-as": null | string; "unique-by": UniqueBy; - default: string; // this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list + /** this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list*/ + default: string; } export interface UnionTagSpec { - id: string; // The name of the field containing one of the union variants + /** The name of the field containing one of the union variants*/ + id: string; "variant-names": { - // the name of each variant + /** the name of each variant*/ [variant: string]: string; }; name: string;