# Syntax validations

{% embed url="<https://youtu.be/_67r4wq23BA?t=622>" %}

You can provide your own syntax validations that will be ran against every command. This function should throw an error if the syntax is incorrect.

{% hint style="info" %}
Callback functions will be checked by WOKCommands automatically. There is no need to actually implement this functionality yourself.
{% endhint %}

{% tabs %}
{% tab title="JavaScript" %}
{% code title="no-callback.js" %}

```javascript
module.exports = (command) => {
  const { commandObject, commandName } = command;

  if (!commandObject.callback) {
    throw new Error(
      `Command "${commandName}" does not have a callback function.`
    );
  }
};
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="no-callback.ts" %}

```typescript
import { Command } from "wokcommands";

export default (command: Command) => {
  const { commandObject, commandName } = command;

  if (!commandObject.callback) {
    throw new Error(
      `Command "${commandName}" does not have a callback function.`
    );
  }
};
```

{% endcode %}
{% endtab %}
{% endtabs %}
