1.0.0 • Published 1 year ago

call-center-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

one real private project => delete test file and private parts => private project ( for other companies' access)

https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c

typescript

'string' can't be used to index type '{}'/ type'any'

const getKeyValue = <U extends keyof T, T extends object>(key: U) => (obj: T) =>
  obj[key];

interface User {
  name: string;
  age: number;
}

// usage
const user: User = {
  name: "John Smith",
  age: 20
};

const getUserName = getKeyValue<keyof User, User>("name")(user);

// => 'John Smith'