---
title: "TS8032 UNSIZED_ARRAY_LENGTH: TypeShade 컴파일러가 진단에 붙이는 오류 코드"
description: "TS8032 UNSIZED_ARRAY_LENGTH, TypeShade 컴파일러의 오류 코드입니다. 스토리지가 아닌 곳의 크기 없는 array<T>에 .length를 씁니다. uniform<array<T>>, 지역 변수, 매개변수가 그렇습니다."
url: https://typeshade.dev/ko/reference/errors/ts8032/
language: ko
---

# `TS8032`

프런트엔드 코드 `UNSIZED_ARRAY_LENGTH`

스토리지가 아닌 곳의 크기 없는 `array<T>`에 `.length`를 씁니다. `uniform<array<T>>`, 지역 변수, 매개변수가 그렇습니다. 런타임 크기의 스토리지 배열은 버퍼에서 길이를 읽습니다. 다른 배열에는 크기를 명시해야 합니다.

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

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

## 예제

example.shade.ts

```ts
"use typeshade"

declare const u: uniform<array<f32>>

function count(): f32 {
  return f32(u.length)
}

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

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

**[TS8051](https://typeshade.dev/ko/reference/errors/ts8051/)** error, 3행: "u" is a list of no fixed length, which a uniform cannot hold: a uniform buffer has one size. Give it a length, `array<T, N>`, or declare "u" as `storage<T>`.

**TS8032** error, 6행: ".length" on an array with no size is not known at compile time. Give the type a size: `array<f32, 3>` rather than `array<f32>`.

## 고치는 법

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

example.shade.ts

```ts
"use typeshade"

class UData {
  items: array<f32, 3>
}

declare const u: uniform<UData>

function count(): f32 {
  return f32(u.items.length)
}

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

## 함께 보기

**[`TS8051`](https://typeshade.dev/ko/reference/errors/ts8051/) `LAYOUT`**

버퍼 바인딩의 저장 타입이 WGSL의 호스트 공유 규칙 하나를 어깁니다. `uniform`이나 `storage` 바인딩 안의 `bool`(단독이든 벡터든), 구조체의 마지막 멤버가 아닌 런타임 크기 `array<T>`, uniform 안의 런타임 크기 배열, uniform 안의 두 행 행렬(`mat2x2`, `mat3x2`, `mat4x2`)이 그렇습니다. 마지막은 WGSL과 std140이 서로 다른 오프셋에 배치합니다([규칙 4.8](https://typeshade.dev/ko/reference/rules/4-8/)).

- [리소스](https://typeshade.dev/ko/guide/language/resources/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

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

- [`src/compiler/ts/lower/expression-prop.ts:69`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/expression-prop.ts#L69)
