microsoft / microsoft/TypeScript

Duplicated files do not check unused @ts-expect-error properly

オープン
#52,616 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs More Info
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Bug Report

🔎 Search Terms

redirectInfo, ts-expect-error

🕗 Version & Regression Information

Tested on 4.3.2, 4.9.5, and next (5.0.0-dev.20230204).

⏯ Playground Link

Reproduction: https://github.com/lamnhh/ts-expect-error-issue

💻 Code

There're 3 packages:

  • package-a:
// @ts-expect-error global
export const SOMETHING: number = global.testNumber;

Anything that has an @ts-expect-error directive will work.

  • a package-b that imports package-a
  • anothe package-c that imports both package-a and package-b.

Install everything, then npm link package-b to use in package-c.

🙁 Actual behavior

Unused '@ts-expect-error' directive.

> typecheck
> tsc --noEmit

../package-b/node_modules/@lamnhh/package-a/index.ts:1:1 - error TS2578: Unused '@ts-expect-error' directive.

1 // @ts-expect-error global
  ~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in ../package-b/node_modules/@lamnhh/package-a/index.ts:1
🙂 Expected behavior

tsc in package-c passes with no error.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

https://github.com/lamnhh/ts-expect-error-issue の再現用リポジトリから始めます。3つのパッケージをインストールし、package-b を package-c にリンクして、package-a の未使用の @ts-expect-error 診断を再現するために package-c で tsc --noEmit を実行します。package-a のディレクティブが有効なまま、package-c がその診断なしで型チェックを通過すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。