Fixed type issues with joins with certain variations of `tsconfig` (fixes #4535, #4457) (#4603)