import { Equatable } from "@siteimprove/alfa-equatable" ; import { Hash , Hashable } from "@siteimprove/alfa-hash" ; import { Serializable } from "@siteimprove/alfa-json" ; import * as json from "@siteimprove/alfa-json" ; public export abstract class Value < T extends string = string > implements Equatable , Hashable , Serializable < Value . JSON < T > > { protected constructor ( ) { } public abstract get type ( ) : T ; public abstract equals ( value ) ; public abstract hash ( hash ) ; public abstract toJSON ( ) ; public abstract toString ( ) ; } public export namespace Value { export interface JSON < T extends string = string > { [ key ] : json . JSON ; type : T ; } export function isValue < T extends string > ( value , type ? ) { return ( value instanceof Value && ( type === undefined || value . type === type ) ) ; } }