smody-library
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

🚀 smody util library

  • 소개

    • 스모디 프로젝트에서 사용되는 범용 타입 모듈입니다.
    • MappedKeyToUnion, PickType 메타 타입을 제공합니다.
  • 설치

npm install smody-library --save-dev
  • 실행

MappedKeyToUnion

import { MappedKeyToUnion } from 'smody-library';

const COLOR = {
  LIGHT_PURPLE: '#F5F3FF',
  PURPLE: '#7B61FF',
  DARK_PURPLE: '#7054FE',
} as const;

type AvailablePickedColor = MappedKeyToUnion<typeof COLOR>;
// => type AvailablePickedColor = "#F5F3FF" | "#7B61FF" | "#7054FE";

PickType

import { PickType } from 'smody-library';

type Person = {
  name: string;
  age: number;
}

type PickedName = PickType<Person, 'name'>
// => PickedName type is string

type PickedAge = PickType<Person, 'age'>
// => PickedAge type is number

Readme

Keywords

Package Sidebar

Install

npm i smody-library

Weekly Downloads

1

Version

1.1.1

License

ISC

Unpacked Size

4.05 kB

Total Files

6

Last publish

Collaborators

  • marco-won
  • woose28
  • ronci