@@ -9,6 +9,8 @@ import { BaseQuery } from '../adapter';
99
1010import type { ErrorReporter } from './ErrorReporter' ;
1111
12+ export type ToString = { toString ( ) : string } ;
13+
1214interface CubeDefinition {
1315 name : string ;
1416 extends ?: ( ...args : Array < unknown > ) => { __cubeName : string } ;
@@ -293,7 +295,7 @@ export class CubeSymbols {
293295 // Extend `includes` with members from hierarchies that should be auto-included
294296 const cubes = type === 'dimensions' ? cube . cubes . map ( ( it ) => {
295297 // TODO recheck `it.joinPath` typing
296- const fullPath = this . evaluateReferences ( null , it . joinPath as ( ) => { toString ( ) : string } , { collectJoinHints : true } ) ;
298+ const fullPath = this . evaluateReferences ( null , it . joinPath as ( ) => ToString , { collectJoinHints : true } ) ;
297299 const split = fullPath . split ( '.' ) ;
298300 const cubeRef = split [ split . length - 1 ] ;
299301
@@ -334,7 +336,7 @@ export class CubeSymbols {
334336
335337 if ( hierarchy ) {
336338 // TODO recheck `this.getResolvedMember(...).levels` typing
337- const levels = this . evaluateReferences ( cubeName , this . getResolvedMember ( 'hierarchies' , cubeName , hierarchyName ) . levels as ( ) => Array < { toString ( ) : string } > , { originalSorting : true } ) ;
339+ const levels = this . evaluateReferences ( cubeName , this . getResolvedMember ( 'hierarchies' , cubeName , hierarchyName ) . levels as ( ) => Array < ToString > , { originalSorting : true } ) ;
338340
339341 levels . forEach ( ( level ) => autoIncludeMembers . add ( level ) ) ;
340342 }
@@ -373,7 +375,7 @@ export class CubeSymbols {
373375 protected membersFromCubes ( parentCube : CubeDefinition , cubes : any [ ] , type : string , errorReporter : ErrorReporter , splitViews : SplitViews , memberSets : any ) {
374376 return R . unnest ( cubes . map ( cubeInclude => {
375377 // TODO recheck `cubeInclude.joinPath` typing
376- const fullPath = this . evaluateReferences ( null , cubeInclude . joinPath as ( ) => { toString ( ) : string } , { collectJoinHints : true } ) ;
378+ const fullPath = this . evaluateReferences ( null , cubeInclude . joinPath as ( ) => ToString , { collectJoinHints : true } ) ;
377379 const split = fullPath . split ( '.' ) ;
378380 const cubeReference = split [ split . length - 1 ] ;
379381 const cubeName = cubeInclude . alias || cubeReference ;
@@ -456,7 +458,7 @@ export class CubeSymbols {
456458 return includes . filter ( include => ! excludesMap . has ( include . member ) ) ;
457459 }
458460
459- protected membersFromIncludeExclude ( referencesFn : ( ...args : Array < unknown > ) => Array < { toString ( ) : string } > , cubeName : string , type : string ) {
461+ protected membersFromIncludeExclude ( referencesFn : ( ...args : Array < unknown > ) => Array < ToString > , cubeName : string , type : string ) {
460462 const references = this . evaluateReferences ( cubeName , referencesFn ) ;
461463 return R . unnest ( references . map ( ( ref : string ) => {
462464 const path = ref . split ( '.' ) ;
@@ -553,11 +555,12 @@ export class CubeSymbols {
553555 return res ;
554556 }
555557
556- protected evaluateReferences < T extends { toString ( ) : string } | Array < { toString ( ) : string } > > (
558+ protected evaluateReferences < T extends ToString | Array < ToString > > (
557559 cube : string | null ,
558560 referencesFn : ( ...args : Array < unknown > ) => T ,
559- options : { collectJoinHints ?: boolean , originalSorting ?: boolean } = { } ) :
560- T extends Array < { toString ( ) : string } > ? Array < string > : T extends { toString ( ) : string } ? string : string | Array < string > {
561+ options : { collectJoinHints ?: boolean , originalSorting ?: boolean } = { }
562+ ) :
563+ T extends Array < ToString > ? Array < string > : T extends ToString ? string : string | Array < string > {
561564 const cubeEvaluator = this ;
562565
563566 const fullPath = ( joinHints , path ) => {
0 commit comments