回答編集履歴

1

エラーメッセージを追加

2021/11/22 18:31

投稿

uraway_
uraway_

スコア116

test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
 
44
44
 
45
- [playground](https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEEQBd4A8Bc8A8BBAfABQCU8AvPvLvCGsiAHbADO8zyMAlgwObwD88AIzwsABgBQoSLARJUATyzYAQkVIV4KmnUYt4UBgoHDR8SQHoL8QBUMgS4ZAPwyAsf8AADIGO5QKaKgcwZAsgyArBkARBgk0cngFIA)
45
+ [playground](https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEEQBd4A8Bc8A8BBAfABQCU8AvPvLvCGsiAHbADO8zyMAlgwObwD88AIzwsABgBQoSLARJUATyzYAQkVIV4KmnUYt4UBgoHDR8SQHoL8QBUMgS4ZAPwyAsf8AADIGO5QKaKgcwZAsgyArBkARBgkreAAVBQAHBAByVXVySm1aeiZWQ2NBEXFo+E5WBgB7VChmZk4eBigAIyR4ZAK6yJi8eM1qZL1Wdi5eEyzzaIA6YOswpvho9t1UgyM+szEcvPhC4tLyypqEesaoiamU-W7uPkyFoZH4K7G96LF4AB9hJfyig3WK6tqd5HHJnUOXQ4J3m2WGIWuV3Ct0WuVeazKny2dQav1uB06bGBvTOYMIACYAMz4-HECRocjwBRAA)
46
46
 
47
47
 
48
48
 
@@ -53,6 +53,14 @@
53
53
  declare let y: <B>() => B extends any ? 1 : 0
54
54
 
55
55
  // エラー: 代入できない
56
+
57
+ // Type '<B>() => B extends any ? 1 : 0' is not assignable to type '<A>() => A extends string ? 1 : 0'.
58
+
59
+ // Type 'A extends any ? 1 : 0' is not assignable to type 'A extends string ? 1 : 0'.
60
+
61
+ // Type '0 | 1' is not assignable to type 'A extends string ? 1 : 0'.
62
+
63
+ // Type '0' is not assignable to type 'A extends string ? 1 : 0'.(2322)
56
64
 
57
65
  x = y
58
66