[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Number](https://evolu.dev/docs/api-reference/common/Number) › PercentageLiteral

```ts
PercentageLiteral:  createTypeWithError(
  "PercentageLiteral",
  percentageLiteralSyntax,
  (cause, value): PercentageLiteralError => ({
    type: "PercentageLiteral",
    value,
    cause,
  }),
  (error) =>
    The value ${safelyStringifyUnknownValue(error.value)} is not a percentage literal. Use a value such as "50%" or "12.5%".,
) ;
```

Defined in: [packages/common/src/Number.ts:106](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/common/src/Number.ts#L106)

Percentage literal Type with compile-time and runtime validation.

Supported formats:

- Integers: `0%`, `50%`, `100%` (0-100)
- One decimal place: `0.1%`, `12.5%`, `99.9%` (0.1-99.9)

The decimal digit is never zero, so `12.0%` must be written as `"12%"`, and
`100%` has no decimal form. For computed values or more precision, use
[Ratio](https://evolu.dev/docs/api-reference/common/Type/variables/Ratio) directly.

See [Percentage](https://evolu.dev/docs/api-reference/common/Number/type-aliases/Percentage) for a type that also accepts [Ratio](https://evolu.dev/docs/api-reference/common/Type/variables/Ratio). Use
[percentageToRatio](https://evolu.dev/docs/api-reference/common/Number/functions/percentageToRatio) to convert.

Invalid values produce a [PercentageLiteralError](https://evolu.dev/docs/api-reference/common/Number/interfaces/PercentageLiteralError).

### Example

```ts
import {
  assertFalse,
  assertOk,
  assertType,
  PercentageLiteral,
} from "@evolu/common";

// The TypeScript type accepts valid spellings and rejects the rest.
const literal: PercentageLiteral = "12.5%";
assertType<Extract<PercentageLiteral, "101%" | "12.0%" | "12.55%">, never>();

// The runtime Type validates the same grammar.
assertOk(PercentageLiteral.fromUnknown(literal), "12.5%");
assertFalse(PercentageLiteral.is("101%"));
```