# AutocompleteRoute

`function` in `core` · v0.5.0

<https://docs.seedcord.org/packages/core/0.5.0/functions/autocomplete-route>

Routes one or more commands' autocomplete to an `AutocompleteHandler`.

Pass the same command route string(s) as the handler's generic. One command branches with `this.match` over its autocompletable fields, several commands share one handler whose arms span every command's fields. Listing fewer or more commands than the handler declares is a compile error, since the decorator routes and the generic must match exactly.

```ts
AutocompleteRoute<Route>(
    routes: Route[]
): <TCtor extends AnyHandlerCtor>(
    constructor: AssertAutocompleteRoute<Route, TCtor>
) => void
```

Routes one or more commands' autocomplete to an `AutocompleteHandler`.

Pass the same command route string(s) as the handler's generic. One command branches with `this.match` over its autocompletable fields, several commands share one handler whose arms span every command's fields. Listing fewer or more commands than the handler declares is a compile error, since the decorator routes and the generic must match exactly.

Parameters.

- `routes` `Route[]` — The command route string(s) this handler serves, e.g. `'search'` or `'search', 'find'`.

Returns `<TCtor extends AnyHandlerCtor>(constructor: AssertAutocompleteRoute<Route, TCtor>) => void`.
