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

Types don't load if alias in import map isn't exact match of package name when importing currency.js from npm #24090

Closed
Benjiko99 opened this issue Jun 3, 2024 · 1 comment
Labels
design limitation something that can't be fixed or is too hard to fix

Comments

@Benjiko99
Copy link

Version: Deno 1.44.0; VS Code Extension v3.37.1

VS Code doesn't show types for a package (tried npm and esh.sh) defined in import maps, if the alias doesn't exactly match the name of the package.

Aliasing npm:currency.js as currency.js will correctly display types in the IDE:
"imports": { "currency.js": "npm:currency.js@2.0.4" }}

If using any other alias, e.g. currency, currency_js, etc. the IDE will stop showing types for the package.

typed untyped

The code compiles and runs in all cases, only type information is affected.

@nathanwhit nathanwhit added lsp related to the language server bug Something isn't working correctly and removed bug Something isn't working correctly labels Jun 3, 2024
@dsherret dsherret added the design limitation something that can't be fixed or is too hard to fix label Jun 3, 2024
@dsherret
Copy link
Member

dsherret commented Jun 3, 2024

This is a design limitation with TypeScript because the package currency.js incorrectly defines its types using a global ambient module:

declare module 'currency.js' {
...
}

The fix here would be for currency.js to not use one of these and stop saying it's only available at "currency.js".

@dsherret dsherret removed the lsp related to the language server label Jun 3, 2024
@dsherret dsherret changed the title Types don't load if alias in import map isn't exact match of package name Types don't load if alias in import map isn't exact match of package name when importing currency.js from npm Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design limitation something that can't be fixed or is too hard to fix
Projects
None yet
Development

No branches or pull requests

4 participants