microsoft / microsoft/TypeScript
Use TypeScript declaration files alongside JavaScript
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 3.9.3
Search Terms:
TypeScript along side JavaScript
Code
Button.jsx
const Button = ({ text, onClick }) => {
return <button onClick={onClick}>{text}</button>
}
Button.d.ts
interface Props {
text: string
onClick: () => void
}
declare const Button: (props: Props) => Element
Expected behavior:
TypeScript should apply the types described in Button.d.ts and use them on Button.jsx.
Actual behavior:
The prop types in Button.jsx are any and are ignoring the typed written in Button.d.ts.
Playground Link: https://codesandbox.io/s/loving-mclaren-dvefd?file=/src/button/Button.jsx
Related Issues: https://stackoverflow.com/questions/53074172/typescript-declaration-files-for-local-js-files
Other Info:
I made a stackoverflow question about this but it doesn't seem to be known there. https://stackoverflow.com/questions/61932377/use-typescript-declaration-files-alongside-javascript
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Button.jsx と Button.d.ts の例から始め、リンクされた CodeSandbox と報告された TypeScript 3.9.3 のバージョンを使って動作を再現します。宣言ファイルが JavaScript ファイルにどのように関連付けられるかを追跡し、焦点を絞ったコンパイラテストで意図された動作を確認します。宣言された props が any として推論されるのではなく適用されるか、またはその制限が文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100