sveltejs/language-tools

Wrong path is resolved when the imports differ in case only

Aperta

#1882 aperta il 20 feb 2023

 (5 commenti) (0 reazioni) (0 assegnatari)TypeScript (247 fork)auto 404
bughelp wanted

Metriche repository

Star
 (1437 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Describe the bug

When there are 2 imports which differ in case only, svelte-check resolves the path wrongly. Eg:

index.ts

import { Favs } from '@core/Favs'; // import 1
import favs from '@core/favs'; // import 2

It fails with an error

Module '"path/to/named/folder/core/Favs"' has no default export.

But it has default export for sure, TS type check works like a charm.

core/Favs.ts

export const Favs = 'I am Favs class';

core/favs.ts

export default 'I am favs utils';

The order counts, when you change index.ts file as following:

import favs from '@core/favs'; // import 2
import { Favs } from '@core/Favs'; // import 1

The error changed to:

Module '"@core/favs"' has no exported member 'Favs'. Did you mean to use 'import Favs from "@core/favs"' instead?

Reproduction

See "Describe the bug" section

Expected behaviour

It should resolve both paths correctly, as tsc does.

System Info

  • OS: MacOS (local) & Debian (CICD)
  • IDE: VSCode & CICD terminal

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

No response

Guida contributor