sveltejs/language-tools

Wrong path is resolved when the imports differ in case only

オープン

#1,882 opened on 2023/02/20

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (247 件のフォーク)auto 404
bughelp wanted

Repository metrics

Stars
 (1,437 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド