본문 바로가기

Interface

(5)
DOCKER Host is unreachable 해결하기 원인: 방화벽 설정 내 맥에서 Container를 만들어서 server로 요청을 날렸을 때 아주 정상적을 잘 동작했다. 그런데 server 컴퓨터에서 Container를 만들어서 server로 요청을 날려보니 다음과 같이 에러가 발생했다. java.net.NoRouteToHostException: Host is unreachable at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/sun.nio.ch.Net.connect(Net.java:503) at java.base/sun.nio.ch.Net.connect(Net.java:492) //...생략 열심히 검색하다보니 iptables를 사용하는 경우 Docker bridge network에..
객체 Type 알아보기 객체의 값과 속성 타입 지정하기 type Height = number; type Name = string; interface IHeightRecord { [name: Name]: Height; } type THeightRecord = { [name: Name]: Height; } const heightRecord: IHeightRecord = { '철수': 170, '영희': 160, '길동': 175 } 구체적으로 속성명과 그 속성값의 type을 정하는 것이 아니라 속성명의 type은 무엇이고, 속성값의 type은 무엇인지만 정의할 수도 있다. interface와 접근제어자 interface IAnimal { readonly name: string; age: number; } type TAnimal =..
Type의 확장 Typescript에서 타입지정을 위해 Type alias와 Interface를 사용할 수 있는데, 이렇게 지정된 type들을 확장하는 기능도 지원하고 있다. 어떻게 확장할 수 있는지 배워보도록 하자! Intersection interface animal { readonly name: string; age: number; } type bird = animal & { wing: number; } type alias 기능을 사용할 때는 &를 사용해 연산하듯이 두 타입을 합칠 수 있다. 이를 `intersection`이라고 부르고, interface나 type alias로 지정된 타입을 모두 결합할 수 있다. 상속 interface animal { readonly name: string; age: number..
Vue에서 TypeScript 사용하기: Data (참고로 Tool은 Webstorm을 썼다!!!) type.ts에 아래와 같이 코드를 작성했다. interface를 이용해 타입을 지정한 코드이다. export interface human { name: string; likeNumber: number; isAdult: boolean; }; 적당히 person.vue에 아래와 같이 코드를 작성했다. 일단 중요한 것은 human을 import하는 부분이다. TypeScript에서는 @가 사용불가능하므로 ..과 같이 경로를 적어줘야 한다. 그리고 TypeScript를 이용할 때는 script tag의 lang 속성에 ts라고 값을 지정해줘야 한다. 가장 중요한 data 부분을 살펴보자!!!! 일단 기존에 Type Customizing 글에서 배운 방법은 '변..
type alias와 interface https://code-mania.tistory.com/29 TypeScript의 type 알아보기 기본적으로 js에는 다음과 같은 type들이 있다. String Number Boolean Array Function Object 타입 지정 방법 이번 시간에는 기본타입을 변수에 적용하는 방법에 대해서 알아볼 것이다. TypeScript는 TypeScript.. code-mania.tistory.com 위 글에서 기본 타입을 알아봤다. 하지만 프로그래밍하다보면 기본 타입만으로는 해결하기 어려운 상황에 직면할 것이다. 이 때 어떤 해결책이 있는지 알아보자~~~~ Type Alias와 Interface 사용자 정의 type을 지정하기 위한 방법으로 type alias와 interface를 이용하는 2가지 방법..