본문 바로가기
728x90
반응형

TypeScript4

타입스크립트 읽어보기 좋은 글 https://basarat.gitbook.io/typescript/getting-started/why-typescript Why TypeScript - TypeScript Deep Dive This type inference is well motivated. If you do stuff like shown in this example, then, in the rest of your code, you cannot be certain that foo is a number or a string. Such issues turn up often in large multi-file code bases. We will deep dive into the basarat.gitbook.io 2023. 11. 23.
Vuejs nuxtjs Typescript Window 사용하기 nuxtjs 기준 /types/{{파일명}}.d.ts declare global { interface Window { test { gettest: () => null | string | undefined; }; } } xxx.vue window.test.gesttest() //형태로 사용함 2023. 4. 25.
nuxtjs .d.ts 파일에 전역 상수 추가하는 방법 Nuxt.js에서 -9로 할당된 전역 상수를 만들려면, 다음과 같이 nuxt-env.d.ts 파일을 만들고, 해당 파일에서 상수를 선언하면 됩니다. declare module '@nuxt/types' { interface Context { $myGlobalConsts: Readonly; } } declare module '@nuxt/types/config/runtime' { interface NuxtRuntimeConfig { myGlobalConsts: Readonly; } } 위의 코드에서 Context와 NuxtRuntimeConfig를 확장하여 $myGlobalConsts 상수를 추가합니다. 또한, 읽기 전용인 Readonly를 사용하여 상수의 값이 변경되지 않도록 합니다. 이제 상수를 사용하려면.. 2023. 4. 18.
react, typescript 유용한사이트 타입스크립트 : https://driip.me/b812974b-3974-46e3-829e-1476b9b30c94 TypeScript 타입 정의 읽기 — 몇 가지만 알면 쉬워요 아마 조금 더 쉬워질걸요? driip.me 리액트 : https://react.gg/visualized 2023. 4. 11.
728x90
반응형