diff --git a/src/parser.ts b/src/parser.ts index fd01a1e..ed3cfd1 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -52,8 +52,8 @@ export const defaultContext = makeContext({ // forcing === and !== isn't a eslint rule for nothing... '==': forall([a, b], f(a, b, bool)), '!=': forall([a, b], f(a, b, bool)), - '===': forall([a, b], f(a, b, bool)), - '!==': forall([a, b], f(a, b, bool)), + '===': forall([a], f(a, a, bool)), + '!==': forall([a], f(a, a, bool)), '!': forall([a], f(a, bool)), '!!': forall([a], f(a, bool)), or: forall([a, b], f(a, b, bool)), diff --git a/test-d/tests.json b/test-d/tests.json index d115b59..af73d57 100644 --- a/test-d/tests.json +++ b/test-d/tests.json @@ -13,14 +13,14 @@ [ {"==":[1,"1"]}, {}, true ], [ {"==":[1,2]}, {}, false ], [ {"===":[1,1]}, {}, true ], - [ {"===":[1,"1"]}, {}, false ], + [ {"===":[1,"1"]}, {}, false, "Number and String" ], [ {"===":[1,2]}, {}, false ], [ {"!=":[1,2]}, {}, true ], [ {"!=":[1,1]}, {}, false ], [ {"!=":[1,"1"]}, {}, false ], [ {"!==":[1,2]}, {}, true ], [ {"!==":[1,1]}, {}, false ], - [ {"!==":[1,"1"]}, {}, true ], + [ {"!==":[1,"1"]}, {}, true, "Number and String" ], [ {">":[2,1]}, {}, true ], [ {">":[1,1]}, {}, false ], [ {">":[1,2]}, {}, false ], @@ -156,7 +156,7 @@ [{"if":[ "0", "apple", "banana"]}, null, "apple"], "You can cast a string to numeric with a unary + ", - [{"===":[0,"0"]}, null, false], + [{"===":[0,"0"]}, null, false, "Number and String" ], [{"===":[0,{"+":"0"}]}, null, true], [{"if":[ {"+":"0"}, "apple", "banana"]}, null, "banana"], [{"if":[ {"+":"1"}, "apple", "banana"]}, null, "apple"],