Using unix command watch for detecting a change in file and executing command:
while true ; do watch -g -d "cat src/index.ts" && yarn run doc-docco ; done
More refined, this time executes the command first:
CMD="yarn run doc-docco"; eval $CMD ; while true ; do watch -g -d "cat src/index.ts" && eval $CMD ; done