/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
import {SCThing, SCThingWithoutReferences} from '../src/things/abstract/thing';
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/things/academic-event';
import {SCArticle, SCArticleWithoutReferences} from '../src/things/article';
import {SCAssessment, SCAssessmentWithoutReferences} from '../src/things/assessment';
import {SCBook, SCBookWithoutReferences} from '../src/things/book';
import {SCBuilding, SCBuildingWithoutReferences} from '../src/things/building';
import {SCCatalog, SCCatalogWithoutReferences} from '../src/things/catalog';
import {SCContactPoint, SCContactPointWithoutReferences} from '../src/things/contact-point';
import {SCCourseOfStudy, SCCourseOfStudyWithoutReferences} from '../src/things/course-of-study';
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/things/date-series';
import {SCDiff, SCDiffWithoutReferences} from '../src/things/diff';
import {SCDish, SCDishWithoutReferences} from '../src/things/dish';
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/things/favorite';
import {SCFloor, SCFloorWithoutReferences} from '../src/things/floor';
import {SCMessage, SCMessageWithoutReferences} from '../src/things/message';
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/things/organization';
import {SCPerson, SCPersonWithoutReferences} from '../src/things/person';
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/things/point-of-interest';
import {SCRoom, SCRoomWithoutReferences} from '../src/things/room';
import {SCSemester, SCSemesterWithoutReferences} from '../src/things/semester';
import {SCSetting, SCSettingWithoutReferences} from '../src/things/setting';
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/things/sport-course';
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/things/study-module';
import {SCTicket, SCTicketWithoutReferences} from '../src/things/ticket';
import {SCToDo, SCToDoWithoutReferences} from '../src/things/todo';
import {SCTour, SCTourWithoutReferences} from '../src/things/tour';
import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
import {SCPeriodical, SCPeriodicalWithoutReferences} from '../src/things/periodical';
import {SCPublicationEvent, SCPublicationEventWithoutReferences} from '../src/things/publication-event';
/**
* Check if E extends T
*/
type Extends = E extends T ? true : false;
/**
* Get type of array elements up to nesting level 3
*/
type ElementType = T extends any[] ?
(T[0] extends any[] ?
(T[0][0] extends any[] ?
T[0][0][0] : T[0][0]) : T[0]) : T;
/**
* Get types of properties
*
* - Extracts only the properties which extend object and are not any.
* - If type is an array it returns the type of the elements.
*/
type PropertyTypes = Extract extends true ?
never : T[keyof T]) : never>
, object>;
/**
* Get nested property types
*/
type PropertyTypesNested = PropertyTypes extends object ? PropertyTypes> : PropertyTypes;
/**
* Types of properties of SCDiff
*/
type SCDiffPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCAcademicEvent
*/
type SCAcademicEventPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCArticle
*/
type SCArticlePropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCAssessment
*/
type SCAssessmentPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCBook
*/
type SCBookPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCBuilding
*/
type SCBuildingPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCContactPoint
*/
type SCContactPointPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCCatalog
*/
type SCCatalogPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCCourseOfStudy
*/
type SCCourseOfStudyPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCDateSeries
*/
type SCDateSeriesPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCDish
*/
type SCDishPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCFavorite
*/
type SCFavoritePropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCFloor
*/
type SCFloorPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCMessage
*/
type SCMessagePropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCOrganization
*/
type SCOrganizationPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCPeriodical
*/
type SCPeriodicalPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCPerson
*/
type SCPersonPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCPointOfInterest
*/
type SCPointOfInterestPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCPublicationEvent
*/
type SCPublicationEventPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCRoom
*/
type SCRoomPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCSemester
*/
type SCSemesterPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCSetting
*/
type SCSettingPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCSportCourse
*/
type SCSportCoursePropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCStudyModule
*/
type SCStudyModulePropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCTicket
*/
type SCTicketPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCToDo
*/
type SCToDoPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCToDo
*/
type SCTourPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Types of properties of SCVideo
*/
type SCVideoPropertyTypes = PropertyTypesNested;
assert>(false);
assert>(true);
assert>(true);
assert>(false);
assert>(false);
assert>(true);
/**
* Dummy interface, to check if union types still resolve to any if one of the members is any
*/
interface Foo {
bar: SCPerson;
foo: any;
}
/**
* Type that is unfortunately never - blame TypeScript
*/
type UnfortunatelyNever = PropertyTypesNested;
assert>(true);
/**
* Flat property types
*/
type FlatPropertyTypes = T[keyof T];
/**
* Type that is unfortunately any - blame TypeScript
*/
type UnfortunatelyAny = FlatPropertyTypes;
assert>(true);