---
title: "SD0107: assignment to an immutable 'let' binding"
description: "SD0107, TypeShade 컴파일러의 오류 코드입니다. assignment to an immutable 'let' binding"
url: https://typeshade.dev/ko/reference/errors/sd0107/
language: ko
---

# `SD0107`

코어 코드

assignment to an immutable 'let' binding

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

## 프런트엔드에서

같은 실수를 한 `"use typeshade"` 파일은 이 검사까지 오지 않습니다. 프런트엔드가 자기 코드로 먼저 거부하기 때문입니다. 빌드할 때 컴파일한 아래 프로그램에는 다음 진단이 나옵니다.

example.shade.ts

```ts
"use typeshade"

@fragment
export function main(uv: location<0, vec2>): vec4 {
  const g = uv.x
  g = g * 2.
  return vec4(g, g, g, 1.)
}
```

**[TS8005](https://typeshade.dev/ko/reference/errors/ts8005/)** error, 6행: Cannot assign to "g" — it is declared with const.

## 고치는 법

레지스트리의 힌트: declare the binding with Var() instead of Let() to mutate it

## 함께 보기

**[`TS8005`](https://typeshade.dev/ko/reference/errors/ts8005/) `CONST_ASSIGN`**

바뀔 수 없는 이름이나 자리에 값을 대입합니다. `const`에 담은 수나 벡터, `const` 벡터나 행렬의 성분, `readonly` 필드나 static, 그리고 `readonly`나 `"read"`로 쓰지 않겠다고 약속한 스토리지 바인딩에는 값을 쓸 수 없습니다. `const` 객체의 필드나 원소에 쓰는 것은 여기에 해당하지 않습니다. `const`는 객체를 담고 있을 뿐이고, 객체는 JavaScript에서처럼 계속 쓸 수 있기 때문입니다([규칙 6.10](https://typeshade.dev/ko/reference/rules/6-10/)).

- [진단](https://typeshade.dev/ko/guide/internals/diagnostics/)
- [`TypeShadeError`](https://typeshade.dev/ko/api/typeshadeerror/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

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

- [`src/core/passes/lint/rules/no-assign-to-let.ts:65`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/lint/rules/no-assign-to-let.ts#L65)
