質問編集履歴

2

指摘箇所を修正

2018/04/15 05:43

投稿

UekiKouji
UekiKouji

スコア121

test CHANGED
File without changes
test CHANGED
@@ -72,13 +72,13 @@
72
72
 
73
73
  const client = new APIClient({
74
74
 
75
- "sample.json": Person
75
+ "/person/1": Person
76
76
 
77
77
  });
78
78
 
79
79
  // エラーの内容 Type 'Person' does not satisfy the constraint 'JSONData'. Index signature is missing in type 'Person'
80
80
 
81
- const person: Person = client.get<Person>("sample.json").data;
81
+ const person: Person = client.get<Person>("/person/1").data;
82
82
 
83
83
  console.log(person.say());
84
84
 

1

記載していないことを追加

2018/04/15 05:43

投稿

UekiKouji
UekiKouji

スコア121

test CHANGED
File without changes
test CHANGED
@@ -5,6 +5,18 @@
5
5
  // sample_json_api.ts
6
6
 
7
7
  ```ここに言語を入力
8
+
9
+ interface APIMapping {
10
+
11
+ [path: string]: Function ;
12
+
13
+ }
14
+
15
+ interface JSONData {
16
+
17
+ [name: string]: JSONData|number|string|boolean| JSONData[];
18
+
19
+ }
8
20
 
9
21
  class GetData<T> {
10
22