Sharryhong's Front-End
  • About Sharryhong's Front-End Blog.
  • Front-End Dev
    • Flutter
      • API Key 안전하게 숨기기. Cloudflare Workers!
      • Web CORS 에러
    • Vue.js
      • usePagination - composition api (vue2)
      • Pagination Component
      • Vue Image Skeleton
      • Sort an Array of Objects by Boolean property
      • Dynamic Components
      • LoadingBar Component
      • composition-api 사용하여 menu 의 outside click 시 close
      • vue+TypeScript
      • Vue.js 개발자를 위한 VS Code
      • Vue3 Chrome Extension
      • input file 선택된 파일 명 reset하기
      • element 내부 scroll 될 때, ScrollTop 값에 따라 div를 보이게, 안보이게 제어하기
      • 진입한 url path에 맞게 메서드 실행
    • React
      • 절대경로(absolute path) 설정, jsx파일로 이동 설정
      • useContext rerender issue
      • Firebase v9 Auth with React
      • Firebase v9 Realtime Database with React
      • React Star Rating (별점 표시)
      • React App deploying (배포)
    • Next.js
      • CSR, SSR, Next.js
    • API Mocking
      • Vue 에서 msw 적용하기
    • Storybook
      • styled-component theme.ts가 storybook엔 적용안되는 이슈
      • storybook에서 alias path 안되는 이슈
      • storybook에 Global Style 적용하기
  • etc
    • brew update
    • npm upgrade (mac)
  • DEV BETTER
    • Clean Code
      • Clean Code JavaScript 강의
        • Variables - 변수 다루기
        • Boundary - 경계 다루기
        • Conditional - 분기 다루기
        • Array - 배열 다루기
      • Tip. 클린 코드를 위한 5가지 팁
      • Tip. 코딩 잘하는 팁 3가지
    • 웹 성능 최적화 (performance)
      • performance 강의
        • loading, rendering performance
        • Tools
        • Image size optimization
        • bottleneck (병목) code 탐색
Powered by GitBook
On this page
  • 이슈
  • 기본적인 빌드 에러 해결
  • 이슈 해결 1. vuejs-logger
  • 이슈 해결 2. Vue.$auth, Vue.$log 타입에러

Was this helpful?

  1. Front-End Dev
  2. Vue.js

vue+TypeScript

2022-04-26

Previouscomposition-api 사용하여 menu 의 outside click 시 closeNextVue.js 개발자를 위한 VS Code

Last updated 2 years ago

Was this helpful?

이슈

리팩토링이 필요한 프로젝트에 투입이 된 후, 여러 개선 사항 리스트를 작성하였습니다.

그 중 TypeScript 적용은 하면 좋으나 시간이 걸릴 작업으로 분류해놓았는데, 다른 개발자분들의 만장일치로 적용하기로 결정하였습니다. 하하

참고 자료

인프런 강의 : 에서 추천한 방법인

$ vue create project-name

로 TypeScript 설치 후 기존 코드를 옮기는 방식으로 진행하였습니다.

tsconfig.json 에 우선 아래 설정을 추가한 뒤 작업 (작업시 값 변경 예정)

"strict": false,
"noImplicitAny": false,
"allowJs": true,

기본적인 빌드 에러 해결

$ npm run build

이슈 해결 1. vuejs-logger

수정 전 ) main.ts

import VueLogger from "vuejs-logger"; 

Vue.use(VueLogger, options) 

수정 후 ) main.ts

import VueLoggerPlugin from "vuejs-logger/dist/vue-logger"; 

Vue.use(VueLoggerPlugin, options)  

이슈 해결 2. Vue.$auth, Vue.$log 타입에러

shims-tsx.d.ts 에 아래 코드 추가

import { OktaAuth } from "@okta/okta-auth-js";

declare module "vue/types/vue" {
  interface VueConstructor {
    $auth: OktaAuth;
    $log: {
      debug(message: string, trace?: {}): void;
      info(message: string, trace?: {}): void;
      warning(message: string, trace?: {}): void;
      error(message: string, trace?: {}): void;
      fatal(message: string, trace?: {}): void;
    };
  }
}

참고자료 :

https://www.inflearn.com/course/vue-ts
https://bestofvue.com/repo/justinkames-vuejs-logger-vuejs-inspect-debugging