Open
Description
Rework to { name, value, toString }
or...
... a proxy
... ok never mind
type ResponseProxy<T, M> = {
(): T;
} & { readonly [K in keyof M]: M[K] };
function response<T>(name: string, value?: T): ResponseProxy<{ name: string, value: T }, T> {
return new Proxy({ name, value }, {
apply(target, thisArg, argumentsList) {
console.log("inside", target, thisArg, argumentsList);
console.log("inside", name);
return name;
}
}) as unknown as ResponseProxy<{ name: string, value: T }, T>;
}
const select = response<string>("Please select a `library` before using this option.", "null");
console.log(select.name, select.value);
console.log(select());
The other option would probably be json or xml format like what's being considered for #73