Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why module name judge like this? #1509

Open
fantian007 opened this issue Feb 28, 2024 · 2 comments
Open

why module name judge like this? #1509

fantian007 opened this issue Feb 28, 2024 · 2 comments

Comments

@fantian007
Copy link

fantian007 commented Feb 28, 2024

Describe the bug

Version: 21.0.1

sourceText:

declare module '@x/y' {};

judge:

const modules = sourceFile.getModules();

modules.forEach(m => {
  if (m.getName() === "'@x/y'") {
    console.log('enter');
  }
});

so, Why ? "'@x/y'" instead of '@x/y'?

And:

const t = sourceFile.getModule('@x/y'); // => undefined ?
const t = sourceFile.getModule("'@x/y'"); // => it works...

Expected behavior
'@x/y'

@fantian007
Copy link
Author

I'm confused...

@dsherret
Copy link
Owner

dsherret commented Mar 9, 2024

These two module names are distinct:

declare module "example" {}
declare module example {}

That said, perhaps it should be normalizing single quotes to double quotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants