1- import { Data , Route } from " @angular/router" ;
1+ import { Data , Route } from ' @angular/router' ;
22
33/**
44 * @interface NavItem
@@ -8,14 +8,14 @@ import { Data, Route } from "@angular/router";
88 * @logo {string} link to logo, can be relative or full URL
99 */
1010export interface FrameConfig {
11- appName : string
12- appNameShort ?: StringOfLength < 0 , 6 >
13- logo : string
11+ appName : string ;
12+ appNameShort ?: StringOfLength < 0 , 6 > ;
13+ logo : string ;
1414}
1515
1616export enum FrameEvents {
17- MANAGE_ACCOUNT = 'EVENT_MANAGE_ACCOUNT' ,
18- LOGOUT = 'EVENT_LOGOUT'
17+ MANAGE_ACCOUNT = 'EVENT_MANAGE_ACCOUNT' ,
18+ LOGOUT = 'EVENT_LOGOUT' ,
1919}
2020
2121/**
@@ -25,8 +25,8 @@ export enum FrameEvents {
2525 * @data {string} data which get send with event
2626 */
2727export interface FrameEvent {
28- type : string ;
29- data : any ;
28+ type : FrameEvents ;
29+ data : any ;
3030}
3131
3232/**
@@ -37,65 +37,63 @@ export interface FrameEvent {
3737 * @profilePicture {string} profile Picture (can be empty)
3838 */
3939export interface NavUser {
40- name : string
41- role : string
42- profilePicture : string
40+ name : string ;
41+ role : string ;
42+ profilePicture : string ;
4343}
4444
4545interface FrameRouteData extends Data {
46- /**
47- * sould this route be visable in sidenav
48- */
49- displaySidemenu : boolean ;
50- /**
51- * displayed text, shows only in opened mode
52- */
53- sidenavText : string ;
54- /**
55- * displayed icon, use **only** material-icons!
56- */
57- sidenavIcon : string ;
58- /**
59- * ...
60- */
61- roles ?: string [ ] ;
62- /**
63- * App title dynamic
64- */
65- title ?: string ;
46+ /**
47+ * sould this route be visable in sidenav
48+ */
49+ displaySidemenu : boolean ;
50+ /**
51+ * displayed text, shows only in opened mode
52+ */
53+ sidenavText : string ;
54+ /**
55+ * displayed icon, use **only** material-icons!
56+ */
57+ sidenavIcon : string ;
58+ /**
59+ * ...
60+ */
61+ roles ?: string [ ] ;
62+ /**
63+ * App title dynamic
64+ */
65+ title ?: string ;
6666}
6767interface FrameRoute extends Route {
68- data ?: FrameRouteData ;
68+ data ?: FrameRouteData ;
6969}
7070export type FrameRoutes = FrameRoute [ ] ;
7171
72-
73-
7472type StringOfLength < Min , Max > = string & {
75- readonly StringOfLength : unique symbol // this is the phantom type
73+ readonly StringOfLength : unique symbol ; // this is the phantom type
7674} ;
7775
7876// This is a type guard function which can be used to assert that a string
7977// is of type StringOfLength<Min,Max>
8078const isStringOfLength = < Min extends number , Max extends number > (
81- str : string ,
82- min : Min ,
83- max : Max
79+ str : string ,
80+ min : Min ,
81+ max : Max
8482) : str is StringOfLength < Min , Max > => str . length >= min && str . length <= max ;
8583
8684// type constructor function
8785export const stringOfLength = < Min extends number , Max extends number > (
88- input : unknown ,
89- min : Min ,
90- max : Max
86+ input : unknown ,
87+ min : Min ,
88+ max : Max
9189) : StringOfLength < Min , Max > => {
92- if ( typeof input !== " string" ) {
93- throw new Error ( " invalid input" ) ;
94- }
90+ if ( typeof input !== ' string' ) {
91+ throw new Error ( ' invalid input' ) ;
92+ }
9593
96- if ( ! isStringOfLength ( input , min , max ) ) {
97- throw new Error ( " input is not between specified min and max" ) ;
98- }
94+ if ( ! isStringOfLength ( input , min , max ) ) {
95+ throw new Error ( ' input is not between specified min and max' ) ;
96+ }
9997
100- return input ; // the type of input here is now StringOfLength<Min,Max>
98+ return input ; // the type of input here is now StringOfLength<Min,Max>
10199} ;
0 commit comments