Declare implementations and dependencies via standard interfaces for operations #8

Merged
glen merged 20 commits from approach4.6 into main 2023-01-22 01:34:57 +00:00
Showing only changes of commit 04024a2a8d - Show all commits

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)),