'a turborepo pipeline task that depends on a root package.json task that does not execute in each package

I have a root package.json task that does not execute in every package that calls yarn tsc.

Currently, I have it as a prebuild script in the root package.json:

"prebuild": "yarn tsc",

Is there anyway to specify this as a dependsOn element of build in the turborepo.json?

If I add tsc like below then it will get executed in the each package which is not what I want.

"pipeline": {
  "tsc": {
    "dependsOn": ["generate"],
    "outputs": ["dist-types/**"]
  },
  "build": {
    "dependsOn": ["tsc", "^build"],
    "outputs": ["dist/**"]
  },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source