'Sharing TsConfig file with child process

I am having an issue with my child process, which is not recognizing the 'tsconfig' file.

error TS2307: Cannot find module '@moduleName' or its corresponding type declarations.
error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfing' to remove this warning.

These errors both occur because of the missing 'tsconfig' file.

I am using the child_process library with the fork method.

ChildProcess.fork(scriptPath, [], {execArgv: process.execArgv.concat(['r', 'ts-node/register'])});

How can I make the child process use the ts config file?

Even a workaround will be great.

Thanks in advance.



Sources

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

Source: Stack Overflow

Solution Source