Skip to content

Udemy/Ts/section5/64: readonly #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
a63622c
🚩: dist의 컴파일된 js를 확인하기 위해서 es5에서 es6로 ts.config 변경
4BFC Sep 20, 2024
e0853e1
🚩: es6에서 es5로 컴파일 target을 변경
4BFC Sep 20, 2024
fc69d9e
🚩: this를 사용해서 출력한 class 내 전역 name 프로퍼티 정상 출력
4BFC Sep 20, 2024
32a0146
🚩: this키워드를 다시 한번 객체로 감싼 복제 함수 할당 후 출력 undefined 결과 확인, this를 사용시 주의 사항
4BFC Sep 20, 2024
61ff6bf
🚩: undefined 재확인
4BFC Sep 20, 2024
8416f2b
🚩: 복제한 class의 함수를 사용 가능하게 하기 위한 방법과 에러 임시적인 해결 단, 똑같이 구현 불가능
4BFC Sep 20, 2024
cbdaa30
🚩: 배열 프로퍼티에 접근하는 두 가지 방식
4BFC Sep 21, 2024
24ebd7d
🚩: private 설정으로 employees[N]에 값을 할당할수 없다. error
4BFC Sep 21, 2024
c7ed403
🚩: 런타임과 컴파일 과정의 private 영향을 ts, js 파일에서 확인
4BFC Sep 21, 2024
01311f2
🚩: private를 일반적으로 constructor에서 사용하는 방법
4BFC Sep 21, 2024
263c777
🚩: constructor 생성자 내부에 따로 선언하지 않고 매개변수로 선언하는 간단한 방법
4BFC Sep 21, 2024
85531b3
🚩: readonly의 사용방법과 build된 app.js에서 확인할 수 있는 property 키워드 확인 및 실습
4BFC Sep 21, 2024
b5e8d70
Merge branch 'UdemyTs' into Udemy/Ts/section5/64
4BFC Sep 25, 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
29 changes: 0 additions & 29 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
"use strict";
var Department = /** @class */ (function () {
function Department(id, name) {
this.id = id;
this.name = name;
// private id: string;
// private name: string;
this.employees = [];
// this.id = id;
// this.name = n
}
Department.prototype.describe = function () {
console.log("Department (".concat(this.id, "): ").concat(this.name));
};
Department.prototype.addEmployee = function (employee) {
this.employees.push(employee);
};
Department.prototype.printEmployeeInformation = function () {
console.log(this.employees.length);
console.log(this.employees);
};
return Department;
}());
var accounting = new Department('1', 'Accounting');
accounting.addEmployee('Max');
accounting.addEmployee('Manu');
// accounting.employees[2] = 'Anna';
accounting.describe();
accounting.printEmployeeInformation();
5 changes: 3 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class Department {
// private id: string;
// private name: string;
private employees: string[] = [];

constructor(private id: string, public name: string) {
// readonly는 프로퍼티를 초기화한 후 수정할 수 없다. 즉, 한번 할당 되면 변경되면 안되는 고유 번호들을 설정할 때 readonly를 사용한다.
constructor(private readonly id: string, public name: string) {
// this.id = id;
// this.name = n
}
Expand All @@ -12,6 +12,7 @@ class Department {
}

addEmployee(employee: string) {
// this.id = '2'; // readonly이기 때문에 error가 발생한다.
this.employees.push(employee);
}
printEmployeeInformation() {
Expand Down