microsoft / microsoft/TypeScript
Wrong import suggestion in subpath pattern
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.75.1
- OS Version: Darwin x64 22.1.0 (MacOS)
Steps to Reproduce:
- Install
@neo4j-ndl/react@1.0.0-alpha-fafbc08 - Try to import an icon like
<AdjustmentsHorizontalIconSolid />in a JSX file.
The recommended import path is @neo4j-ndl/react/lib/types/icons while the correct based on the exports field would be @neo4j-ndl/react/icons
The modified package.json is looking like this:
{
"name": "@neo4j-ndl/react",
"version": "0.17.7",
"sideEffects": false,
"description": "React implementation of Neo4j Design System",
"keywords": [
"neo4j",
"react",
"design system",
"needle",
"ndl"
],
"author": "Neo4j Inc.",
"homepage": "",
"license": "GPL-3.0",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"exports": {
"./icons": {
"import": "./lib/esm/icons/index.js",
"require": "./lib/cjs/icons/index.js",
"types": "./lib/types/icons/index.d.ts"
},
".": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js",
"types": "./lib/types/index.d.ts"
}
},
...
}
As a library publishers tried it also with WebStorm to see how it behaves and I can see that there it is imported as expected (video):
Also noticed, that if there is one module imported from @neo4j-ndl/react/icons then the suggestion works as expected (image):

コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
変更した package.json とその exports フィールドを使用して JSX ファイルで問題を再現し、@neo4j-ndl/react/icons パッケージの例から始めます。パッケージのサブパスパターンに対する import 提案の動作を追跡し、@neo4j-ndl/react/icons から import した後の動作するケースと比較します。提案されるパスが @neo4j-ndl/react/lib/types/icons ではなく @neo4j-ndl/react/icons になれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100