"Static 멤버가 instance 가 아닌 class 에 살아. Static method 안 `this` 가 class 자체."
Static 멤버
static 가 각 instance 아닌 class 에 속하는 멤버 선언. class Foo { static count = 0 } 의미 `Foo.count` 가 모든 사용 가로질러 공유되는 한 값; `new Foo().count` 가 존재 안 함. Static 필드와 method 가 instance 아니라 class 이름 통해 접근.
흔한 사용: factory method (static create()), counter 나 registry (static instances: Foo[] = []), 상수 (static readonly MAX = 100).
Static method 안 `this`
Static method 안 `this` 가 (instance 아닌) class 자체 참조. static create(): Foo { return new this() } 가 `this` 통해 새 instance 만들어 — 그리고 여기 `this` 가 class. 이 패턴이 상속에 옳게 작동: subclass 의 `create` 가 호출하는 class 에 `this` 가 bind 되니까 parent 아닌 subclass constructor 호출.
`this` 타입
TypeScript 가 return annotation 으로 polymorphic `this` 타입 지원. class Builder { setX(): this } 가 "호출 site 의 `this` 가 뭐든 반환" 말함 — 보통 호출 class, 각 method 가 가장-derived 타입 반환하는 fluent 체이닝 가능. builder.setX().setY() 가 subclass 통해서도 작동.