@harmoniclabs/plu-ts-onchain
Version:
An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript
8 lines (7 loc) • 334 B
TypeScript
type SingleKeyObj<K extends string | number | symbol, V = any> = {
[Prop in K]: (Record<Prop, V> & Record<Exclude<K, Prop>, never>) extends infer O ? {
[Q in keyof O]: O[Q];
} : never;
}[K];
export default SingleKeyObj;
export type IsSingleKey<Obj extends object> = Obj extends SingleKeyObj<keyof Obj> ? true : false;