---
title: "Rule 5.5: Literals and typing, a TypeShade design rule"
description: "Rule 5.5 of the TypeShade language design, in Literals and typing. A single float-written literal valued as a whole number may take a declared integer type in…"
url: https://typeshade.dev/reference/rules/5-5/
language: en
---

# Rule 5.5

Chapter 5, Literals and typing Test

A single float-written literal valued as a whole number may take a declared integer type in a declaration only; a return, an argument, and a field must not take that carve-out.

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

## Rationale

the carve-out predates the integer rule and was kept so that programs did not break; extending it would make `1e3` an integer in places where it never was.

## Derives from

surface §13.

## 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:

`src/compiler/ts/int-lit-context.test.ts`, which covers the ten declared positions.

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

- [`src/compiler/ts/int-lit-context.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/int-lit-context.test.ts#L1)

## Explained in

The sections of the surface document that explain this rule, at commit af54ddad5:

- [§13 Integer literals](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#13-integer-literals)

## See also

- [Rule 5.4](https://typeshade.dev/reference/rules/5-4/) Test
- [Rule 6.1](https://typeshade.dev/reference/rules/6-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:450`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L450) (the design document)
- [`reqs/rules/RULE-0505.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0505.md) (its traceability item)
