Skip to content

Instantly share code, notes, and snippets.

@joonseokhu
Last active November 1, 2021 08:30
Show Gist options
  • Save joonseokhu/a409973579d152e25a477e4adaa0f1f5 to your computer and use it in GitHub Desktop.
Save joonseokhu/a409973579d152e25a477e4adaa0f1f5 to your computer and use it in GitHub Desktop.
// MyClass/index.ts
import { FuncA, FuncB } from './types'

export default class MyClass {
  funcA(param1: FuncA.Param1, param2: FuncA.Param2): FuncA.Response {
    return blabla
  }

  async funcB(param1: FuncB.Param): Promise<FuncB.Response> {
    return blabla
  }
}

export {
  FuncA,
  FuncB,
}

////////////////

// 저걸 사용하는 다른 파일

import MyClass, { FuncA, FuncB } from './some/path/MyClass

const myClass = new MyClass()

const callA = (param: FuncA.param1) => {
  console.log('A ~')
  const foo = myClass.funcA(param, ['FuncA.param2의 타입이 문자열배열'])
  // foo 가지고 뭘 또 한다.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment