typescript, graphql-codejen설치

모크장·2023년 11월 17일

typescript-install

1.설치
npm의 경우 npm install typescript --save-dev
yarn인 경우 yarn add typescript --dev
https://www.typescriptlang.org/download

  1. tsconfig.json 파일 생성
    https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

사용방법 예시 코드를 복사
next.js인 경우 yarn dev를 실행시키면 자동생성
yarn add --dev @types/react @types/node 추가 설치

현재는 18버전보다 17버전을 더 많이 사용하기 때문에 17버전으로 재설치한다
"@types/node": "17.0.2"
"@types/react": "17.0.2"

*yarn.rock도 삭제하고 node_modules 재설치

graphql-codegen install

1.설치
https://the-guild.dev/graphql/codegen/docs/getting-started/installation

npm i -D typescript @graphql-codegen/cli

yarn add --dev typescript @graphql-codegen/cli
yarn add --dev typescript @graphql-codegen/typescript
yarn add ts-node
=>package.json "script"부분에 추가 할 항목: "generate":"graphql-codegen"

profile
시작하는 개발자

0개의 댓글