---
title: "TS8035 CLASS_MEMBER: TypeShade 컴파일러가 진단에 붙이는 오류 코드 한 가지"
description: "TS8035 CLASS_MEMBER, TypeShade 컴파일러의 오류 코드입니다. 표면이 받지 않는 클래스 멤버 모양, 클래스 규칙이 거부하는 멤버 사용, 클래스를 만들지 않는 new입니다(규칙 8.13)."
url: https://typeshade.dev/ko/reference/errors/ts8035/
language: ko
---

# `TS8035`

프런트엔드 코드 `CLASS_MEMBER`

표면이 받지 않는 클래스 멤버 모양, 클래스 규칙이 거부하는 멤버 사용, 클래스를 만들지 않는 `new`입니다([규칙 8.13](https://typeshade.dev/ko/reference/rules/8-13/)). getter와 setter, static 필드와 메서드, 오버로드 시그니처, abstract 멤버, `#` 비공개 이름, 객체를 바꾸는 메서드는 모두 컴파일됩니다. 메시지가 멤버나 대상과 고칠 방법을 알려 줍니다.

레지스트리에는 이 상수에 대한 문서 주석이 없습니다. 그래서 위 설명은 컴파일러가 이 코드와 함께 내는 메시지를 보고 이 사이트가 쓴 것입니다.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

## 예제

example.shade.ts

```ts
"use typeshade"

class Ray {
  origin: vec3
  static count: f32 = 0.
  static { Ray.count = 1. }
}

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv, 0., 1.)
}
```

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

**TS8035** error, 6행: A static block runs when the class is defined, and a shader has no such moment. Give each static field its value where it is declared.

## 고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts

```ts
"use typeshade"

class Ray {
  origin: vec3
  static count: f32 = 1.
}

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv, 0., 1.)
}
```

## 이 코드가 적용하는 규칙

**[규칙 6.7](https://typeshade.dev/ko/reference/rules/6-7/) 테스트**

The attribute names the compiler reads are `vertex`, `fragment`, `compute`, `workgroup_size`, `builtin`, `location`, `interpolate`, `invariant` and `blend_src` (the last three since [#168](https://github.com/typeshade/typeshade/issues/168), surface §53).

**[규칙 6.10](https://typeshade.dev/ko/reference/rules/6-10/) 테스트**

A local `const` binds its name once and leaves what it holds as writable as TypeScript does.

**[규칙 8.1](https://typeshade.dev/ko/reference/rules/8-1/) 테스트**

An entry point is a function declaration at the top of the file or of a namespace, exported or not, with exactly one stage attribute written before the declaration: `@vertex export function vs(…)`, `@fragment …`, or `@compute([x, y?, z?]) …`.

**[규칙 8.9](https://typeshade.dev/ko/reference/rules/8-9/) 테스트**

Method dispatch must be static, and a generic function or class must be compiled once per set of type arguments the program uses ([Rule 3.9](https://typeshade.dev/ko/reference/rules/3-9/)).

**[규칙 8.10](https://typeshade.dev/ko/reference/rules/8-10/) 테스트**

A method that writes its object (assigns to `this` or to a field, a component or an element of it, applies `++` or `--` to one, hands one to a parameter that its function writes ([Rule 8.25](https://typeshade.dev/ko/reference/rules/8-25/)), or calls such a method or reads such a getter on `this`, on a field, a component or an element of it whatever class that field is, or through `super`) must take the object by reference, and may return a value like any other method; a base’s body that a class calls through `super` and that writes its object takes it by reference too, and so does the copy of a method that takes a function ([Rule 8.18](https://typeshade.dev/ko/reference/rules/8-18/)) when a function handed over writes the variable the call is on.

**[규칙 8.11](https://typeshade.dev/ko/reference/rules/8-11/) 테스트**

A `get` or `set` accessor is a function of the module, `Owner_get_x` or `Owner_set_x`, which takes its object as a method does ([Rules 8.10](https://typeshade.dev/ko/reference/rules/8-10/) and [8.28](https://typeshade.dev/ko/reference/rules/8-28/)); a read of `o.x` must call the getter, and an assignment, a compound assignment, `++` and `--` must call the setter with the new value, the compound forms reading the old one through the getter.

**[규칙 8.12](https://typeshade.dev/ko/reference/rules/8-12/) 테스트**

A private name `#x` must be emitted without its `#`: a field as the struct member `x`, a method as `Owner_x`, an accessor as `Owner_get_x` and `Owner_set_x`, a static field as `Owner_x`.

**[규칙 8.13](https://typeshade.dev/ko/reference/rules/8-13/) 테스트**

A static field must be a module constant `Owner_x` when nothing in the program writes it, and a module variable in the per-invocation space ([Rule 6.5](https://typeshade.dev/ko/reference/rules/6-5/)) when something does; a `readonly` static is never written.

**[규칙 8.15](https://typeshade.dev/ko/reference/rules/8-15/) 테스트**

A member declared `private` may be named only inside the body of the class that declares it, and one declared `protected` only inside the bodies of that class and of the classes that extend it, on an object of the naming body’s own class or of one that extends it; a name either rule does not allow must be refused with the remedy.

**[규칙 8.16](https://typeshade.dev/ko/reference/rules/8-16/) 테스트**

An instance field that holds an arrow function or a function expression is a method of its class under the field’s name: the function’s parameters, return type and body are the method’s, an expression body is the value it returns, and `this` in it is the object, as it is in TypeScript.

## 함께 보기

- [함수](https://typeshade.dev/ko/guide/language/functions/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

- [`src/compiler/ts/builtin-check.ts:448`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/builtin-check.ts#L448)
- [`src/compiler/ts/lower/class-access/checks.ts:28`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/class-access/checks.ts#L28)
- [`src/compiler/ts/lower/class-methods/push-diag.ts:11`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/class-methods/push-diag.ts#L11)
- [`src/compiler/ts/lower/expression-prop.ts:172`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop.ts#L172) (3곳)
- [`src/compiler/ts/lower/function-signature/parameters.ts:133`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function-signature/parameters.ts#L133)
- [`src/compiler/ts/lower/function.ts:2486`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function.ts#L2486)
- [`src/compiler/ts/lower/new-target.ts:71`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/new-target.ts#L71) (3곳)
- [`src/compiler/ts/lower/statement/writable.ts:59`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/writable.ts#L59) (2곳)
- [`src/compiler/ts/semantic.ts:293`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/semantic.ts#L293)
- [`src/compiler/ts/structs/diagnostics.ts:7`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/structs/diagnostics.ts#L7)
- [`src/language-service/diagnostics/refusal-tables.ts:11`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics/refusal-tables.ts#L11) (2곳)
- [`src/language-service/diagnostics/refused-attributes.ts:64`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics/refused-attributes.ts#L64)
