# desc

## Call Signature

> **desc**\<`N`\>(`name`): [`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `never`\>\>

Defined in: [src/query/order.ts:147](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/d464c8dce16c3b8c472479ac5aae9d14344eb067/src/query/order.ts#L147)

Sorts by an attribute, largest first, in the order values compare in — see
`ComparisonOperator`. Entities where the attribute is unset, or set with another type, come
last.

### Type Parameters

#### N

`N` *extends* `string`

### Parameters

#### name

`N`

An attribute of any type but bytes, indexed or not, or one of the system
attributes `$key`, `$owner`, `$creator` and `$expiresAt`.

### Returns

[`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `never`\>\>

### Throws

If the name is outside the attribute name grammar.

### Throws

If the name starts with `$` but is not a queryable system
attribute, the type is bytes or not a type, or a system attribute is given another type.

### Example

```ts
desc("score")             // through a schema: score:dec DESC
desc("score", "u256")     // without one: score:u256 DESC
```

## Call Signature

> **desc**\<`N`, `T`\>(`name`, `type`): [`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `T`\>\>

Defined in: [src/query/order.ts:148](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/d464c8dce16c3b8c472479ac5aae9d14344eb067/src/query/order.ts#L148)

Sorts by an attribute, largest first, in the order values compare in — see
`ComparisonOperator`. Entities where the attribute is unset, or set with another type, come
last.

### Type Parameters

#### N

`N` *extends* `string`

#### T

`T` *extends* [`IndexableTypeTag`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/type-aliases/indexabletypetag/)

### Parameters

#### name

`N`

An attribute of any type but bytes, indexed or not, or one of the system
attributes `$key`, `$owner`, `$creator` and `$expiresAt`.

#### type

`T`

The type to sort the attribute as. A system attribute's is fixed, and through a
schema it is the column's, so it is needed only for a query without one.

### Returns

[`OrderTerm`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/interfaces/orderterm/)\<`OrderRef`\<`N`, `T`\>\>

### Throws

If the name is outside the attribute name grammar.

### Throws

If the name starts with `$` but is not a queryable system
attribute, the type is bytes or not a type, or a system attribute is given another type.

### Example

```ts
desc("score")             // through a schema: score:dec DESC
desc("score", "u256")     // without one: score:u256 DESC
```