Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d105911
🌱: README을 수정
4BFC Aug 26, 2024
06270b7
🌱: README을 수정
4BFC Aug 26, 2024
5e69dee
🌱: README을 수정
4BFC Aug 29, 2024
d7c1360
🌱: README을 수정
4BFC Aug 29, 2024
978d932
🌱: README을 수정
4BFC Aug 29, 2024
859bffc
🌱: README을 수정
4BFC Aug 29, 2024
e09d95d
🌱: README을 수정
4BFC Aug 29, 2024
3255009
🌱: README을 수정
4BFC Aug 29, 2024
ab9b8db
🌱: README을 수정
4BFC Aug 29, 2024
5f0f9f9
🌱: README을 수정
4BFC Aug 29, 2024
daaeeed
🌱: README을 수정
4BFC Aug 29, 2024
c8ec455
🌱: README을 수정
4BFC Aug 30, 2024
e2a15fd
🌱: README을 수정
4BFC Aug 30, 2024
61dd842
🌱: README을 수정
4BFC Aug 30, 2024
bce5c89
🌱: README을 수정
4BFC Aug 30, 2024
ed8fa00
🌱: issue templates 생성
4BFC Aug 30, 2024
1559fa2
🌱: pr-template 생성
4BFC Aug 30, 2024
691897a
🌱: pr-template 수정
4BFC Aug 30, 2024
44ec035
🌱: pr-template 수정
4BFC Aug 30, 2024
3c3280b
🚩: udemy section2의 14번 강의를 듣고 실습을 했다.
4BFC Aug 31, 2024
cbf04eb
🔀: Merge branch 'UdemyTs'
4BFC Aug 31, 2024
0f07929
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Aug 31, 2024
757fb99
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Aug 31, 2024
7e8ac7d
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Aug 31, 2024
aa89074
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
79304fe
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
eb21a7f
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
cf56f00
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
7dec10d
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
28200e9
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 1, 2024
621e700
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 2, 2024
5f9833d
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 2, 2024
06d966b
Merge branch 'UdemyTs' of https://github.com/Programming-Contents-Lis…
4BFC Sep 20, 2024
6dbfd8c
🚩: interface를 학습하기 위해 클래스를 학습하고 실습해보았다.
4BFC Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
"use strict";
// const ADMIN = 0;
// const READ_ONLY = 1;
// const AUTHOR = 2;
var Role;
(function (Role) {
Role[Role["ADMIN"] = 0] = "ADMIN";
Role[Role["READ_ONLY"] = 1] = "READ_ONLY";
Role[Role["AUTHOR"] = 2] = "AUTHOR";
})(Role || (Role = {}));
var person = {
name: 'Maximilian',
age: 30,
hobbies: ['Sports', 'Cooking'],
role: Role.ADMIN, //0
};
person.role = Role.READ_ONLY;
if (person.role === Role.ADMIN) {
console.log(person.role);
}
else if (person.role === Role.READ_ONLY) {
console.log(person.role);
}
else if (person.role === Role.AUTHOR) {
console.log(person.role);
}
var Department = /** @class */ (function () {
function Department(n) {
this.name = n;
}
return Department;
}());
var accounting = new Department('Accounting');
console.log(accounting);
16 changes: 0 additions & 16 deletions dist/basics.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
}
}
}
24 changes: 0 additions & 24 deletions src/app.js

This file was deleted.

26 changes: 7 additions & 19 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
let userInput: unknown;

let userName: string;
userInput = 5;
userInput = 'Max';

console.log(typeof userInput);

if (typeof userInput === 'string') {
userName = userInput;
class Department {
name: string;
constructor(n: string) {
this.name = n;
}
}

function generateError(message: string, code: number): never { //:never
throw { message: message, errorCode: code };
} //generateError는 never타입을 반환한다. 이유는 throw 때문인데 절대적으로 값이 변하면 안되기 때문이다. 따라서 never타입은 다음과 같다.
//never 타입은 어떠한 값도 반환하지 않는 함수의 반환 타입을 나타낸다. 이 타입은 함수가 정상적으로 완료되지 않고 항상 예외를 던지거나 무한 루프에 빠져 끝나지 않는 경우에 사용된다. 오해하지 말아야할 것은 literal type으로 확인을 하면 void로 선언이 되어있지만 throw를 사용하면 무조건으로 never가 반환된다. 따라서 암묵적으로 never를 반환은 하지만 never타입임을 코드에 명시해주는 것이 좋다.

const resultError = generateError('An error occurred!', 500);
console.log('resultError: ', resultError); //본래 일반적인 함수라면 undefined를 반환해야한다.
//하지만 아무것도 반환되는 것이 없다. 이유는 generateError는 never 타입으로 반환이 되기 때문에 컴파일이 중도 정지가 되는 것이다.
//참고로 throw는 try,catch를 사용해도 무시하지 않고 중도 정지가 된다.
const accounting = new Department('Accounting');
console.log(accounting);
41 changes: 0 additions & 41 deletions src/basics.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/functions.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/union-aliases.ts.ts

This file was deleted.