diff --git a/implementations/javascript/src/values.ts b/implementations/javascript/src/values.ts index 724ac6e..b7a0640 100644 --- a/implementations/javascript/src/values.ts +++ b/implementations/javascript/src/values.ts @@ -15,9 +15,29 @@ export * from './dictionary'; export type DefaultPointer = object; -export type Value = Atom | Compound | T | Annotated; -export type Atom = boolean | SingleFloat | DoubleFloat | number | string | Bytes | symbol; -export type Compound = Record | Array> | Set | Dictionary, T>; +export type Value = + | Atom + | Compound + | T + | Annotated; +export type Atom = + | boolean + | SingleFloat + | DoubleFloat + | number + | string + | Bytes + | symbol; +export type Compound = + | (Array> | [Value]) & { label: Value } + // ^ expanded from definition of Record<> in record.ts, + // because if we use Record, Tuple>, T>, + // TypeScript currently complains about circular use of Value, + // and if we use Record, it accepts it but collapses + // Value to any. + | Array> + | Set + | Dictionary, T>; export function fromJS(x: any): Value { switch (typeof x) {