---
title: "TS8010 STRUCT_FIELD: TypeShade 컴파일러가 진단에 붙이는 오류 코드 한 가지"
description: "TS8010 STRUCT_FIELD, TypeShade 컴파일러의 오류 코드입니다. 구조체 필드나 선언의 모양이 잘못되었습니다. 필드가 없는 클래스는 받아들입니다."
url: https://typeshade.dev/ko/reference/errors/ts8010/
language: ko
---

# `TS8010`

프런트엔드 코드 `STRUCT_FIELD`

구조체 필드나 선언의 모양이 잘못되었습니다. 필드가 없는 클래스는 받아들입니다. 이 코드는 잘못된 필드 선언, 클래스가 아닌 빈 구조체, 적용되지 않는 필드의 `@align`, 사용처마다 location이 둘로 갈리는 사용자 정의 값을 다룹니다([규칙 6.6](https://typeshade.dev/ko/reference/rules/6-6/)).

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

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

## 예제

example.shade.ts

```ts
"use typeshade"

class Tint {
  rgb: vec3
  alpha: f32
}

function tint(uv: vec2): Tint {
  return { rgb: vec3(uv, 0.) }
}

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

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

**TS8010** error, 9행: Missing field "alpha" for struct Tint.

## 고치는 법

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

example.shade.ts

```ts
"use typeshade"

class Tint {
  rgb: vec3
  alpha: f32
}

function tint(uv: vec2): Tint {
  return { rgb: vec3(uv, 0.), alpha: 1. }
}

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

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

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

An entry point’s inputs and outputs are explicit parameters and return values.

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

The byte layout the emitted module assumes for a resource and the layout `reflect()` reports must agree byte for byte, under WGSL’s uniform and storage layout rules, and so must the layout the manifest carries ([Rule 11.10](https://typeshade.dev/ko/reference/rules/11-10/)); a vertex entry’s vertex buffer is one layout, its `@location` inputs tightly packed in the order written and numbered in that order where no `location<n, T>` states the number ([Rule 6.6](https://typeshade.dev/ko/reference/rules/6-6/)), which `reflect().vertex` and the manifest both report.

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

A struct must be the members written in it, in one of four spellings (`class`, `interface`, a `type` over an object literal, an object type literal written where a type stands).

**[규칙 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.14](https://typeshade.dev/ko/reference/rules/8-14/) 테스트**

A constructor’s parameter property (`constructor(public x: f32)`, or `private`, `protected` or `readonly` in place of `public`) is a field of its class, at the constructor’s place among the members, which the constructor assigns from the parameter before the field initializers run.

**[규칙 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.

## 함께 보기

**[`SD0020`](https://typeshade.dev/ko/reference/errors/sd0020/)**

module validation failed

- [타입](https://typeshade.dev/ko/guide/language/types/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

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

- [`src/compiler/ts/entry-locations.ts:69`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/entry-locations.ts#L69)
- [`src/compiler/ts/lower/expression-prop/object-literal.ts:74`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop/object-literal.ts#L74) (5곳)
- [`src/compiler/ts/lower/function-signature/parameters.ts:316`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/function-signature/parameters.ts#L316)
- [`src/compiler/ts/source-file.ts:383`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/source-file.ts#L383)
- [`src/compiler/ts/structs/diagnostics.ts:11`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/structs/diagnostics.ts#L11)
- [`src/compiler/ts/structs/entry-io.ts:186`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/structs/entry-io.ts#L186) (2곳)
- [`src/language-service/diagnostics/refusal-tables.ts:10`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics/refusal-tables.ts#L10)
