You can patch @types/foo
locally for your app by patch-package.
-
Run
npm i -D patch-package
-
Simply modify
node_modules/@types/foo
to suit your needs. -
Run
npx patch-package @types/foo
. This creates a diff file inpatches/
that records the changes made from the last step. -
Add
"scripts": {"postinstall": "patch-package"}
inpackage.json
. This make patches to be applied each time people runnpm install
.