microsoft / microsoft/TypeScript

Incorrect ts(7053) error when updating json file

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

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

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

Bug Report

I have strings stored in a json file.
I did set "resolveJsonModule": true, in the tsconfig.
I import the strings as follows:
import * as strings from '../languages/en.json';

Works perfectly.

When I add a string in the json file and I then try to use that new string, intellisense always gives me the ts(7053) error.

Everything builds and works but the code remains underlined as a problem.

The only workaround I found to get rid of the incorrect report is to close VSCode and reopen it.

Broken in TypeScript v4.1.5
Works in TypeScript v4.0.5

VS Code
Version: 1.53.2
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:45:54.515Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin x64 20.3.0

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

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

はじめの一歩

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

調査の方向性

resolveJsonModuleを有効にし、インポートしたJSONファイルと新しく追加した文字列を使用して問題を再現し、TypeScript 4.1.5と4.0.5を比較します。まず、診断 ts(7053) の背後にあるlanguage serviceの動作を調べ、JSONが変更されたときにVS Codeを再起動せずに診断が消えることを確認します。

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

評価

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

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

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