microsoft / microsoft/TypeScript

Unwanted auto-imports in script files

Offen
#55,256 14 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@andrewbranch arbeitet bereits daran.

Seit 03.8.2023.

Effort: Moderate Experience Enhancement Help Wanted Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Bug Report

I have a mixture of module and non-module code.
The problem occurs when I edit non-module files (tsconfig: "module": "none").

Sometimes when using auto-completion (in VisualStudio 2022) typescript finds a "matching" name from the module world and adds a line like

import { HmiHelper } from './helper/HmiHelper.js';

into the first line of my file.
But as the current file was configured as "module": "none" this import pushes typescript into modules mode and the current code is invalid.

🔎 Search Terms

intellisense
auto-import
modules

🕗 Version & Regression Information

This bug is many years old and persists in Typescript 5.1.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.