Skip to content

Typescript file imports being appended with .js extensions intermittently #52167

Closed
@AaronMcCloskey

Description

@AaronMcCloskey

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.74.2
  • OS Version: macOS Monterey 12.6

Steps to Reproduce:

  1. Commented out all of my settings.json file, so uses the default settings
  2. Restart VSCode with Extensions Disabled
  3. In certain .ts files in my project, when I go to import another .ts file the autocomplete option for the import adds a .js file extension.
  4. The same import made in another .ts file in the same directory or another directory, does not append the .js file extension.
  5. Sometimes in the .ts file(s) that appends the .js file extension on the auto import, when I remove all of the code and then try to import, it does not append the .js extension. But if I close the file and re-open it again, it will. But this is intermittent.
  6. See Videos below for issue
  • Sorry, had to split in 2 due to file sizes
Screen.Recording.2022-12-29.at.21.16.32.mov
Screen.Recording.2022-12-29.at.21.18.10.mov

Not sure how much the tsconfig.json file can affect this but this is my ts config.

{
  "compilerOptions": {
    "target": "es2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true /* Report errors on unused locals. */,
    "noUnusedParameters": true /* Report errors on unused parameters. */,
    "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["next-env.d.ts", "types/**/*.ts", "next-auth.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.cjs", "**/*.mjs"],
  "exclude": ["node_modules"]
}

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions