123456789101112131415161718192021222324252627 |
- import type {Organization, SharedViewOrganization} from './organization';
- // from:
- // - https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
- // - https://www.typescriptlang.org/play/#example/assertion-functions
- // This declares a function which asserts that the expression called
- // value is true:
- // eslint-disable-next-line prettier/prettier
- export function assert(_value: unknown): asserts _value {}
- // This declares a function which asserts that the expression called
- // value is of type Type:
- // eslint-disable-next-line prettier/prettier
- export function assertType<Type>(_value: unknown): asserts _value is Type {}
- export function isNotSharedOrganization(
- maybe: Organization | SharedViewOrganization
- ): maybe is Organization {
- return typeof (maybe as Organization).id !== 'undefined';
- }
- export type DeepPartial<T> = T extends object
- ? {
- [P in keyof T]?: DeepPartial<T[P]>;
- }
- : T;
|