Skip to content

Commit

Permalink
Typeguard tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanburke committed Dec 20, 2024
1 parent bda6191 commit f15e7de
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "functype",
"version": "0.8.39",
"version": "0.8.40",
"description": "A smallish functional library for TypeScript",
"author": "[email protected]",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/list/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { None, Option } from "../option/Option"
import { Set } from "../set/Set"
import { Typeable } from "../typeable/Typeable"

type TypeGuard<A, B extends A> = (a: A) => a is B
type TypeGuard<A, B extends A> = (a: A | undefined) => a is B

type FilterFn<A> = {
<B extends A>(p: TypeGuard<A, B>): List<B>
Expand Down
2 changes: 1 addition & 1 deletion test/list/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe("List", () => {
})

it("filter with regular predicate", () => {
const largeShapes = shapes.filter((shape) => shape.value > 4)
const largeShapes = shapes.filter((shape) => !!shape && shape.value > 4)
expect(largeShapes.toValue()).toEqual({
_tag: "List",
value: [{ _tag: "circle", kind: "circle", value: 5 }],
Expand Down

0 comments on commit f15e7de

Please sign in to comment.