@@ -3,6 +3,7 @@ import R from 'ramda';
33
44import type { NodePath } from '@babel/traverse' ;
55import {
6+ SymbolResolver ,
67 TranspilerCubeResolver ,
78 TranspilerInterface ,
89 TranspilerSymbolResolver ,
@@ -59,7 +60,7 @@ export class CubePropContextTranspiler implements TranspilerInterface {
5960 args [ 0 ] . node . type === 'TemplateLiteral' &&
6061 args [ 0 ] . node . quasis . length &&
6162 args [ 0 ] . node . quasis [ 0 ] . value . cooked ;
62- args [ args . length - 1 ] . traverse ( this . sqlAndReferencesFieldVisitor ( cubeName ) ) ;
63+ args [ args . length - 1 ] . traverse ( this . sqlAndReferencesFieldVisitor ( cubeName as string ) ) ;
6364 args [ args . length - 1 ] . traverse (
6465 this . knownIdentifiersInjectVisitor ( 'extends' , name => this . cubeDictionary . resolveCube ( name ) )
6566 ) ;
@@ -72,11 +73,11 @@ export class CubePropContextTranspiler implements TranspilerInterface {
7273 } ;
7374 }
7475
75- protected transformObjectProperty ( path : NodePath < t . ObjectProperty > , resolveSymbol : ( name : string ) => void ) {
76+ protected transformObjectProperty ( path : NodePath < t . ObjectProperty > , resolveSymbol : SymbolResolver ) {
7677 CubePropContextTranspiler . replaceValueWithArrowFunction ( resolveSymbol , path . get ( 'value' ) ) ;
7778 }
7879
79- public static replaceValueWithArrowFunction ( resolveSymbol : ( name : string ) => any , value : NodePath < any > ) {
80+ public static replaceValueWithArrowFunction ( resolveSymbol : SymbolResolver , value : NodePath < any > ) {
8081 const knownIds = CubePropContextTranspiler . collectKnownIdentifiers (
8182 resolveSymbol ,
8283 value ,
@@ -91,7 +92,7 @@ export class CubePropContextTranspiler implements TranspilerInterface {
9192 ) ;
9293 }
9394
94- protected sqlAndReferencesFieldVisitor ( cubeName ) : TraverseObject {
95+ protected sqlAndReferencesFieldVisitor ( cubeName : string | null | undefined ) : TraverseObject {
9596 const resolveSymbol = n => this . viewCompiler . resolveSymbol ( cubeName , n ) ||
9697 this . cubeSymbols . resolveSymbol ( cubeName , n ) ||
9798 this . cubeSymbols . isCurrentCube ( n ) ;
@@ -171,7 +172,7 @@ export class CubePropContextTranspiler implements TranspilerInterface {
171172 return fp ;
172173 }
173174
174- protected knownIdentifiersInjectVisitor ( field : RegExp | string , resolveSymbol : ( name : string ) => void ) : TraverseObject {
175+ protected knownIdentifiersInjectVisitor ( field : RegExp | string , resolveSymbol : SymbolResolver ) : TraverseObject {
175176 return {
176177 ObjectProperty : ( path ) => {
177178 if ( path . node . key . type === 'Identifier' && path . node . key . name . match ( field ) ) {
@@ -181,8 +182,8 @@ export class CubePropContextTranspiler implements TranspilerInterface {
181182 } ;
182183 }
183184
184- protected static collectKnownIdentifiers ( resolveSymbol , path : NodePath ) {
185- const identifiers = [ ] ;
185+ protected static collectKnownIdentifiers ( resolveSymbol : SymbolResolver , path : NodePath ) : string [ ] {
186+ const identifiers : string [ ] = [ ] ;
186187
187188 if ( path . node . type === 'Identifier' ) {
188189 CubePropContextTranspiler . matchAndPushIdentifier ( path , resolveSymbol , identifiers ) ;
@@ -197,7 +198,7 @@ export class CubePropContextTranspiler implements TranspilerInterface {
197198 return R . uniq ( identifiers ) ;
198199 }
199200
200- protected static matchAndPushIdentifier ( path , resolveSymbol , identifiers ) {
201+ protected static matchAndPushIdentifier ( path , resolveSymbol : SymbolResolver , identifiers : string [ ] ) {
201202 if (
202203 ( ! path . parent ||
203204 ( path . parent . type !== 'MemberExpression' || path . parent . type === 'MemberExpression' && path . key !== 'property' )
0 commit comments