From f52e6f418a7796d7833910f438320779331b97f3 Mon Sep 17 00:00:00 2001 From: zhongsp Date: Sat, 21 Sep 2019 16:24:17 +0800 Subject: [PATCH] Adds a note about `strictFunctionTypes` to type compatibility PR1103 --- doc/handbook/Type Compatibility.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/handbook/Type Compatibility.md b/doc/handbook/Type Compatibility.md index 4d1644c..5b59999 100644 --- a/doc/handbook/Type Compatibility.md +++ b/doc/handbook/Type Compatibility.md @@ -135,6 +135,8 @@ listenEvent(EventType.Mouse, ((e: MouseEvent) => console.log(e.x + "," + e.y)) a listenEvent(EventType.Mouse, (e: number) => console.log(e)); ``` +你可以使用`strictFunctionTypes`编译选项,使TypeScript在这种情况下报错。 + ## 可选参数及剩余参数 比较函数兼容性的时候,可选参数与必须参数是可互换的。