From 69b2b1fff865d7ae50e8e90a3056c6d0553a1a52 Mon Sep 17 00:00:00 2001 From: Matt Pocock Date: Sun, 19 Feb 2023 21:26:26 +0000 Subject: [PATCH] Fix for Set.has --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/entrypoints/set-has.d.ts | 2 +- src/tests/set-has.ts | 10 ---------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ca869..158a530 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @total-typescript/ts-reset +## 0.3.2 + +### Patch Changes + +- Removed the ability to use Set.has as a type predicate. This ensures that Set.has never sets the checked element to never. + ## 0.3.1 ### Patch Changes diff --git a/package.json b/package.json index b3e1403..3597983 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@total-typescript/ts-reset", - "version": "0.3.1", + "version": "0.3.2", "description": "A CSS reset for TypeScript, improving types for common JavaScript API's", "private": false, "repository": "https://github.com/total-typescript/ts-reset", diff --git a/src/entrypoints/set-has.d.ts b/src/entrypoints/set-has.d.ts index d534fee..2da70da 100644 --- a/src/entrypoints/set-has.d.ts +++ b/src/entrypoints/set-has.d.ts @@ -1,5 +1,5 @@ /// interface Set { - has(value: T | (TSReset.WidenLiteral & {})): value is T; + has(value: T | (TSReset.WidenLiteral & {})): boolean; } diff --git a/src/tests/set-has.ts b/src/tests/set-has.ts index 0318b5f..288bf98 100644 --- a/src/tests/set-has.ts +++ b/src/tests/set-has.ts @@ -15,13 +15,3 @@ doNotExecute(() => { true, ); }); - -doNotExecute(() => { - const set = new Set([1, 2, 3] as const); - - let member = 1; - - if (set.has(member)) { - type tests = [Expect>]; - } -});