Skip to content

Commit

Permalink
Fix for Set.has
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Feb 19, 2023
1 parent 7460c2f commit 69b2b1f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/entrypoints/set-has.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="utils.d.ts" />

interface Set<T> {
has(value: T | (TSReset.WidenLiteral<T> & {})): value is T;
has(value: T | (TSReset.WidenLiteral<T> & {})): boolean;
}
10 changes: 0 additions & 10 deletions src/tests/set-has.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Equal<typeof member, 1 | 2 | 3>>];
}
});

0 comments on commit 69b2b1f

Please sign in to comment.