Skip to content

Instantly share code, notes, and snippets.

@AlexzanderFlores
Created September 10, 2022 16:28
Show Gist options
  • Save AlexzanderFlores/e8ad5c88bfd501c607c2f1fdd8107da2 to your computer and use it in GitHub Desktop.
Save AlexzanderFlores/e8ad5c88bfd501c607c2f1fdd8107da2 to your computer and use it in GitHub Desktop.
Syntax based validation example
// This is written in JS but the handler will still have TS support as expected
module.exports = (command) => {
const { instance, commandName, commandObject } = command
if (commandObject.testOnly !== true || instance.testServers.length) {
return
}
throw new Error(
`Command "${commandName}" is a test only command, but no test servers were specified.`
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment