---
title: "TS8018 ASSIGN_TARGET: a TypeShade compiler error code"
description: "TS8018 ASSIGN_TARGET, an error code of the TypeShade compiler. An assignment or ++/-- target that is not a writable place, such as a temporary."
url: https://typeshade.dev/reference/errors/ts8018/
language: en
---

# `TS8018`

Front-end code `ASSIGN_TARGET`

An assignment or `++`/`--` target that is not a writable place, such as a temporary. An unknown name is `UNKNOWN_NAME`, and a write to a known immutable binding is `CONST_ASSIGN`.

The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.

The registry text and every compiler message on these pages are the compiler's own English.

## Example

example.shade.ts

```ts
"use typeshade"

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

Compiled at build time against the pinned compiler, this program gets:

**TS8018** error, line 5: Assignment target must be a name, or a field, component or element of one.

## How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts

```ts
"use typeshade"

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

## The rules this enforces

**[Rule 8.11](https://typeshade.dev/reference/rules/8-11/) Test**

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/reference/rules/8-10/) and [8.28](https://typeshade.dev/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.

**[Rule 8.17](https://typeshade.dev/reference/rules/8-17/) Test**

A local function (a `const` that holds an arrow function or a function expression, or a `function` declaration, written inside a function’s body) is a function of the module named after the body that declares it (surface §14), and it may read and write the variables of the functions around it, as a TypeScript closure does.

## See also

- [Types](https://typeshade.dev/guide/language/types/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

Where the compiler raises this code at commit af54ddad5, one line per file:

- [`src/compiler/ts/lower/class-access.ts:350`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/class-access.ts#L350)
- [`src/compiler/ts/lower/control/for-update.ts:122`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/control/for-update.ts#L122)
- [`src/compiler/ts/lower/statement/assign.ts:113`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/assign.ts#L113)
- [`src/compiler/ts/lower/statement/lvalue.ts:85`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/lvalue.ts#L85) (5 sites)
- [`src/compiler/ts/lower/statement/writable.ts:51`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/lower/statement/writable.ts#L51) (4 sites)
- [`src/language-service/diagnostics/refused-uses.ts:113`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics/refused-uses.ts#L113)
