GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix Issue #39155 (importModuleSpecifierEnding does not apply for module specifier completions) by Simar-B · Pull Request #42467 · microsoft/TypeScript

Conversation

@Simar-B

@Simar-B Simar Bassi (Simar-B) commented Jan 23, 2021

Copy link
Copy Markdown
Contributor

Fixes #39155

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Simar-B
Pass preferences down to getCompletionEntriesForRelativeModules
d201a1f
@typescript-bot TypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Jan 23, 2021
@ghost

Deleted user (ghost) commented Jan 23, 2021 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Simar Bassi (Simar-B) added 3 commits January 26, 2021 20:30
@Simar-B
Add preferences to getExtensionsOptions call
d419d5b
@Simar-B
Add test case
a92549a
@Simar-B
Fix test case typos
30f6494
@Simar-B
Simar Bassi (Simar-B) marked this pull request as ready for review January 30, 2021 06:48
@sandersn
Nathan Shively-Sanders (sandersn) requested review from Andrew Branch (andrewbranch) and Sheetal Nandi (sheetalkamat) March 9, 2021 19:30
@sandersn Nathan Shively-Sanders (sandersn) assigned Andrew Branch (andrewbranch) Mar 9, 2021
andrewbranch
Andrew Branch (andrewbranch) approved these changes Mar 22, 2021
View reviewed changes

@andrewbranch Andrew Branch (andrewbranch) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Simar-B reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@andrewbranch
Andrew Branch (andrewbranch) merged commit 4622718 into microsoft:master Mar 22, 2021
@Simar-B

Simar Bassi (Simar-B) commented Mar 22, 2021

Copy link
Copy Markdown
Contributor Author

My pleasure!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlCalzone

AlCalzone commented Jun 19, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Andrew Branch (@andrewbranch) this does not seem to have any effect for me in TypeScript 4.3. With

	"javascript.preferences.importModuleSpecifierEnding": "js",
	"typescript.preferences.importModuleSpecifierEnding": "js",

TypeScript defaults to importing a .ts file and then complains that the import may not end in .ts:
grafik
grafik

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@silkfire

Gabriel Bider (silkfire) commented Jun 19, 2021

Copy link
Copy Markdown

Why are you storing TypeScript code in .js files?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlCalzone

AlCalzone commented Jun 19, 2021

Copy link
Copy Markdown
Contributor

I'm not. #33079 and https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm for some context

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@silkfire

Gabriel Bider (silkfire) commented Jun 19, 2021

Copy link
Copy Markdown

These are two separate things. If you don't want the linter to complain you need to set that in the settings, so the TS Server knows what extensions you are expecting in your imports.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlCalzone

AlCalzone commented Jun 19, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Did you even read my first comment? I've set the setting to use a js extension, but TypeScript adds a ts extension instead. It then complains about the ts extension and proposes a js extension, which is what I've wanted anyways.

Side note: It would be even better to not have to deal with this, but we'll have to wait for the TypeScript team to finalize the ESM support for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@silkfire

Gabriel Bider (silkfire) commented Jun 19, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

I'm sorry, I didn't mean to misunderstand you. That must surely be a bug as specifying "js" should not result in a spurious .ts extension being suggested by TS for files that aren't even TypeScript files.

I see, what would the upshot of that be?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlCalzone

AlCalzone commented Jun 19, 2021

Copy link
Copy Markdown
Contributor

in a spurious .ts extension being suggested by TS for files that aren't even TypeScript files.

They are TypeScript files. But importing them with a .js extension is currently the recommended way to do ESModules, because TypeScript does not yet change the extension during compilation. So we need to specify the filename the file is going to have at runtime, which is also why TS suggests using a .js extension.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andrewbranch

Andrew Branch (andrewbranch) commented Jun 21, 2021

Copy link
Copy Markdown
Member

AlCalzone I believe you’re describing #44374, fixed by #44602.

AlCalzone reacted with thumbs up emoji AlCalzone reacted with hooray emoji
All reactions
  • 👍 1 reaction
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@andrewbranch Andrew Branch (andrewbranch) andrewbranch approved these changes
@sheetalkamat Sheetal Nandi (sheetalkamat) Awaiting requested review from sheetalkamat

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@andrewbranch Andrew Branch (andrewbranch)

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

PR Backlog
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

importModuleSpecifierEnding does not apply for module specifier completions (manual imports)

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@Simar-B @AlCalzone @silkfire @andrewbranch @typescript-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.