microsoft / microsoft/TypeScript
Consecutive function declaration problems in JS files
オープン
まだ誰も着手していません。
Bug
Domain: JSDoc
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
🔎 Search Terms
function declaration, method declaration, consecutive, comma
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about jsdoc problems
Tested with typescript@4.4.0-dev.20210602
⏯ Playground Link
💻 Code
/**
* @param {number} num
* @returns {number}
*/
const numb = (num) => num,
/**
* @param {string} str
* @returns {string}
*/
str = (str) => str
console.log(numb(2), str(4))
🙁 Actual behavior
Because of the consecutive declaration the real error is not catched. This only happens in js files
🙂 Expected behavior
Method declaration style shouldn't matter in js files either, so the error should be: ""Argument of type 'number' is not assignable to parameter of type 'string'."
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Playground の再現を提供された JavaScript コードで実行し、連続するカンマ区切りの宣言によって意図した引数型の診断が抑制されることを確認します。JavaScript の型チェックパスを見つけ、例のリグレッションテストを追加します。number を string に割り当てられないと報告すれば、期待される動作に一致して完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100