mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	refactor(react): add type safety for note labels
This commit is contained in:
		| @@ -9,3 +9,4 @@ export * from "./lib/bulk_actions.js"; | ||||
| export * from "./lib/server_api.js"; | ||||
| export * from "./lib/shared_constants.js"; | ||||
| export * from "./lib/ws_api.js"; | ||||
| export * from "./lib/attribute_names.js"; | ||||
|   | ||||
							
								
								
									
										45
									
								
								packages/commons/src/lib/attribute_names.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								packages/commons/src/lib/attribute_names.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| type Labels = { | ||||
|     color: string; | ||||
|     iconClass: string; | ||||
|     workspaceIconClass: string; | ||||
|     executeDescription: string; | ||||
|     executeTitle: string; | ||||
|     limit: string; // should be probably be number | ||||
|     calendarRoot: boolean; | ||||
|     workspaceCalendarRoot: boolean; | ||||
|     archived: boolean; | ||||
|     sorted: boolean; | ||||
|     template: boolean; | ||||
|     autoReadOnlyDisabled: boolean; | ||||
|     language: string; | ||||
|     originalFileName: string; | ||||
|     pageUrl: string; | ||||
|  | ||||
|     // Search | ||||
|     searchString: string; | ||||
|     ancestorDepth: string; | ||||
|     orderBy: string; | ||||
|     orderDirection: string; | ||||
|  | ||||
|     // Collection-specific | ||||
|     viewType: string; | ||||
|     status: string; | ||||
|     pageSize: number; | ||||
|     geolocation: string; | ||||
|     readOnly: boolean; | ||||
|     expanded: boolean; | ||||
|     "calendar:hideWeekends": boolean; | ||||
|     "calendar:weekNumbers": boolean; | ||||
|     "calendar:view": string; | ||||
|     "map:style": string; | ||||
|     "map:scale": boolean; | ||||
|     "board:groupBy": string; | ||||
|     maxNestingDepth: number; | ||||
|     includeArchived: boolean; | ||||
| } | ||||
|  | ||||
| export type LabelNames = keyof Labels; | ||||
|  | ||||
| export type FilterLabelsByType<U> = { | ||||
|     [K in keyof Labels]: Labels[K] extends U ? K : never; | ||||
| }[keyof Labels]; | ||||
		Reference in New Issue
	
	Block a user