diff --git a/src/data/arr.ts b/src/data/arr.ts index ddb8631..dbf9c79 100644 --- a/src/data/arr.ts +++ b/src/data/arr.ts @@ -1,2 +1,16 @@ export const arrNumber = [2, 6, 3, 6, 5]; -export const arrString = ['1']; \ No newline at end of file +export const arrString = ['1']; + +//이 둘은 같은 타입이다. 타입을 따로 지정하지 않으면 string으로 기본값을 가진다. - 타입 추론 +let element_1: string = 'bmw'; +let element_2 = 'bmw'; + +const element = { + age: 30, + isAdult: true, + a: [1, 2, 3], + a2: [1, 2, 3], +} + +let week1: string[] = ['mon', 'tue', 'wed']; +let week2: Array = ['mon', 'tue', 'wed']; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 71987a5..179268f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,4 @@ -import { arrNumber, arrString } from "./data/arr"; +// null, undefined -const showItems = (arr: string[]) => { - arr.forEach(element => console.log(element)); -} -//여기서 함수 자체 파라메터에서도 타입을 개발자가 직접 넣어볼 수 있지 않을까? -showItems(arrString); \ No newline at end of file +let a: null = null; +let b: undefined = undefined; \ No newline at end of file