I recently started transitioning a project from a mixed JS/TS setup to fully TypeScript. The project's server is hosted on AWS Lambda, and I have a tsconfig file at the root level as well as one in the /lambdas directory.
One issue I've encountered is that when I move a TypeScript file, VSCode prompts me to update imports, which I agree to. However, this only fixes the imports within the moved file itself and does not update any dependencies that reference the moved file. Interestingly, JavaScript imports are able to correctly update files that are also JavaScript, even though I have a jsconfig set up too.
Any ideas on what might be causing this misconfiguration?
Below is the relevant file structure where the movements are made within /lambdas subfolders:
-- lib
tsconfig.json
-- lambdas
tsconfig.json
Both tsconfig files currently have identical configurations:
{
"compilerOptions": {
"allowJs": true,
"target": "ES2020",
"module": "commonjs",
"lib": ["es2020", "dom"],
"declaration": true,
"outDir": "./dist",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"esModuleInterop": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["node_modules", "cdk.out"]
}
For example, here is a failed import update within lambdas/tests:
import { makeBiFriendship, makeUniFriendship } from '../routes/users_ts'; // should be ../routes/users/users_ts