Generalize constraints on keys in KeyedDictionary

This commit is contained in:
Tony Garnock-Jones 2023-12-16 09:37:47 +13:00
parent 2a6d0912b6
commit 634b263ed2
1 changed files with 3 additions and 3 deletions

View File

@ -1,17 +1,17 @@
import { Encoder, canonicalEncode, canonicalString } from "./encoder";
import { Encodable, Encoder, canonicalEncode, canonicalString } from "./encoder";
import { Tag } from "./constants";
import { FlexMap, FlexSet, _iterMap } from "./flex";
import { Value } from "./values";
import { Bytes } from './bytes';
import { GenericEmbedded } from "./embedded";
import type { Preservable } from "./encoder";
import type { Writer, PreserveWritable } from "./writer";
import type { Writable, Writer, PreserveWritable } from "./writer";
import { annotations, Annotated } from "./annotated";
export type DictionaryType = 'Dictionary' | 'Set';
export const DictionaryType = Symbol.for('DictionaryType');
export class KeyedDictionary<K extends Value<T>, V, T = GenericEmbedded> extends FlexMap<K, V>
export class KeyedDictionary<K extends (Encodable<T> & Writable<T>), V, T = GenericEmbedded> extends FlexMap<K, V>
implements Preservable<T>, PreserveWritable<T>
{
get [DictionaryType](): DictionaryType {