Declare implementations and dependencies via standard interfaces for operations #8
@ -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)),
|
||||
|
Loading…
Reference in New Issue
Block a user