[Typescript] Use never for readable string
const demoFunc = <TObj extends {}>(obj: TObj, key: ErrorIfNever<keyof TObj, `You much pass at least one key`>) => {
return obj[key as keyof TObj]
}
type ErrorIfNever<T, TError> = [T] extends [never] ? TError: T;
demoFunc({}, 'example')