# Uri

A type-level URI component record.

## Signatures

```ts
export interface Uri<Protocol extends string = string, Username extends string = "", Password extends string = "", Hostname extends string = string, Port extends number | "" = "", Pathname extends string = "/", Query extends string = "", Hash extends string = ""> {
    readonly protocol: Protocol;
    readonly username: Username;
    readonly password: Password;
    readonly hostname: Hostname;
    readonly port: Port;
    readonly pathname: Pathname;
    readonly query: Query;
    readonly hash: Hash;
}
```

```ts
export declare namespace Uri {
    type Any = Uri<string, string, string, string, number | "", string, string, string>;
}
```

## Why

Parsing and formatting share one explicit protocol, authentication, host, path, query, and hash shape.

## Ownership and lifetime

`Uri` is a compile-time component record. Supplying its type arguments creates no runtime URL object or retained input.

## Property: hash

The URI fragment component without its leading hash.

## Property: hash: Why

Formatting controls delimiters while preserving the literal fragment payload.

## Property: hash: Ownership and lifetime

The `Uri.hash` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: hostname

The URI host-name component.

## Property: hostname: Why

Base-URI application can inherit host identity independently of path/query/hash.

## Property: hostname: Ownership and lifetime

The `Uri.hostname` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: password

The URI authentication password component.

## Property: password: Why

Authentication formatting can preserve an explicitly empty or literal password.

## Property: password: Ownership and lifetime

The `Uri.password` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: pathname

The URI pathname component.

## Property: pathname: Why

Relative input can replace the base path without changing inherited origin components.

## Property: pathname: Ownership and lifetime

The `Uri.pathname` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: port

The numeric port component or an absent empty string.

## Property: port: Why

Formatting adds a colon only when a port exists.

## Property: port: Ownership and lifetime

The `Uri.port` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: protocol

The URI scheme component.

## Property: protocol: Why

Formatting normalizes its colon and double-slash delimiters.

## Property: protocol: Ownership and lifetime

The `Uri.protocol` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: query

The URI query component without its leading question mark.

## Property: query: Why

Formatting controls delimiters while preserving the literal query payload.

## Property: query: Ownership and lifetime

The `Uri.query` component is carried only as a type argument on `Uri`; no runtime field or resource exists.

## Property: username

The URI authentication username component.

## Property: username: Why

Authentication formatting remains separate from host and path.

## Property: username: Ownership and lifetime

The `Uri.username` component is carried only as a type argument on `Uri`; no runtime field or resource exists.
