質問編集履歴

1

試したこと「4」で書いたURLを参考にしながら行って、わからなかったことを詳細化しました。

2018/06/19 08:13

投稿

shinzooon
shinzooon

スコア9

test CHANGED
File without changes
test CHANGED
@@ -66,8 +66,42 @@
66
66
 
67
67
  ### 試したこと
68
68
 
69
- 1、npm install --save @types/react-typist ⇨ 無い
69
+ 1、上記エラー文から typescriptが認識できるよう react-typist のモジュールが必要であることが判明。
70
70
 
71
- 2、TypeScriptのために型定義を自作しなければならないのだと解釈する。
71
+ (参照したQ&A: [Typescript react - Could not find a declaration file for module ''react-materialize'.](https://stackoverflow.com/questions/41462729/typescript-react-could-not-find-a-declaration-file-for-module-react-material))
72
72
 
73
- 3、https://templecoding.com/blog/2016/03/31/creating-typescript-typings-for-existing-react-components/ を参考に型定義(.d.tsファイル)の自作を試みるがうまく行かない。
73
+
74
+
75
+ 2、現時点で推奨されている最新の型定義方法を試す、が存在しなかった。
76
+
77
+ npm install --save @types/react-typist ⇨ 無い
78
+
79
+
80
+
81
+ 3、TypeScriptのために型定義を自作しなければならないのだと解釈する。
82
+
83
+ (参考にしたQ&A: [Typescript react - Could not find a declaration file for module ''react-materialize'.](https://stackoverflow.com/questions/41462729/typescript-react-could-not-find-a-declaration-file-for-module-react-material))
84
+
85
+
86
+
87
+ 4、上記のQ&Aの回答として挙げられていた[Creating TypeScript typings for existing React components](https://templecoding.com/blog/2016/03/31/creating-typescript-typings-for-existing-react-components/) を参考に型定義(.d.tsファイル)の自作を試みる。
88
+
89
+
90
+
91
+ 5、指示通り、package.json に "typings":... の記述、index.d.ts ファイル作成まで終えた。
92
+
93
+
94
+
95
+ 6、その後の工程での指示内容が理解できない。
96
+
97
+  例えば
98
+
99
+ 1、この記事の筆者は react-selectize の型定義を宣言しようとしているが、
100
+
101
+ 型定義したいコンポーネントが react-typist の場合 interface props の属性の記述を変更
102
+
103
+ しなくて良いのか。
104
+
105
+
106
+
107
+ 2、そもそもこの interface を各場所は index.d.ts 内で良いのか。