---
title: "Rule 2.4: Sources of the surface, a TypeShade design rule"
description: "Rule 2.4 of the TypeShade language design, in Sources of the surface. An ECMAScript name that has a WGSL meaning must lower to that meaning…"
url: https://typeshade.dev/reference/rules/2-4/
language: en
---

# Rule 2.4

Chapter 2, Sources of the surface Test

An ECMAScript name that has a WGSL meaning must lower to that meaning, and an ECMAScript name that has no WGSL meaning is still an ECMAScript name, whatever the backend expands it to.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

## Rationale

`Math.cbrt` is what a TypeScript author writes; that WGSL has no `cbrt` is the compiler’s problem and does not make `cbrt` a TypeShade invention.

## Derives from

[Numeric Built-in Functions](https://gpuweb.github.io/gpuweb/wgsl/#numeric-builtin-functions) for the names that exist there; `src/compiler/ts/math-alias.ts` for the mapping.

## How it is verified

Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.

Where the rule says the compiler enforces it:

`surface-names.test.ts` (`the Math and console stand-ins declare only members the real ones have`).

The files that verify it at commit af54ddad5, each at the first line that names the rule:

- [`src/compiler/ts/cbrt.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/cbrt.test.ts#L1)
- [`src/core/spec-conformance/surface-names.test.ts:52`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/spec-conformance/surface-names.test.ts#L52)

## See also

- [Rule 2.3](https://typeshade.dev/reference/rules/2-3/) Test
- [Rule 3.1](https://typeshade.dev/reference/rules/3-1/) Test
- [Design rules](https://typeshade.dev/reference/rules/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

The rule at commit af54ddad5:

- [`docs/language-design.md:189`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L189) (the design document)
- [`reqs/rules/RULE-0204.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0204.md) (its traceability item)
