sam-goodwin / punchcard

Type-safe AWS infrastructure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use module augmentation for shape-derived DSL

sam-goodwin opened this issue · comments

commented

The Type interface is tightly-coupled to derived DSLs like DynamoPath, JsonPath, etc.

Can we inject these with module augmentation so shapes can be extended to support new domains?

export interface Type<V> {
kind: Kind;
validate(value: V): void;
toJsonPath(parent: JsonPath<any>, name: string): JsonPath<V>;
toDynamoPath(parent: DynamoPath, name: string): DynamoPath;
toJsonSchema(): {[key: string]: any};
toGlueType(): {
inputString: string;
isPrimitive: boolean;
};
hashCode(value: V): number;
equals(a: V, b: V): boolean;
}