fix a TS issue

This commit is contained in:
Jos de Jong 2022-12-23 12:22:41 +01:00
parent cbd1719227
commit 04024a2a8d

View File

@ -7,7 +7,7 @@ export type Complex<T> = { re: T; im: T; }
export const Complex_type = {
test: <T>(dep: { testT: (z: unknown) => z is T }) =>
(z: unknown): z is Complex<T> =>
typeof z === 'object' && 're' in z && 'im' in z
typeof z === 'object' && z != null && 're' in z && 'im' in z
&& dep.testT(z.re) && dep.testT(z.im),
infer: (dep: typeOfDependency) =>
(z: Complex<unknown>) => joinTypes(dep.typeOf(z.re), dep.typeOf(z.im)),