Right now prettify-ts may resolve some types incorrectly because it is missing path to tsconfig.json file. This is issue for example when allowJs and checkJs flags are enabled in the tsconfig.json and project relies on importing js files. This can be fixed in prettifyType function when ts-morph Project is instanciated:
This is implementation of trying to find tsconfig.json in the root workspace folder of the current file. This may not work perfectly in monorepos, where multiple tsconfig.json may be present in subfolder, but I'd say that this is good enough and this implementation only used a single filesystem call to test whether the tsconfig file exists. Alternatively this can be implemented by checking the file's parent directories to find existing tsconfig. This would result in multiple fs calls because the config would be usually found near the root.
Right now prettify-ts may resolve some types incorrectly because it is missing path to
tsconfig.json
file. This is issue for example whenallowJs
andcheckJs
flags are enabled in thetsconfig.json
and project relies on importing js files. This can be fixed inprettifyType
function when ts-morphProject
is instanciated:This is implementation of trying to find
tsconfig.json
in the root workspace folder of the current file. This may not work perfectly in monorepos, where multipletsconfig.json
may be present in subfolder, but I'd say that this is good enough and this implementation only used a single filesystem call to test whether the tsconfig file exists. Alternatively this can be implemented by checking the file's parent directories to find existing tsconfig. This would result in multiple fs calls because the config would be usually found near the root.