@@ -25,7 +25,7 @@ import {
2525import { ValidationAcceptor , getContainerOfType , streamAst } from 'langium' ;
2626import { findUpAst , getContainingDataModel } from '../../utils/ast-utils' ;
2727import { AstValidator } from '../types' ;
28- import { isAuthOrAuthMemberAccess , translateExpressionTypeToResolve , typeAssignable } from './utils' ;
28+ import { isAuthOrAuthMemberAccess , typeAssignable } from './utils' ;
2929
3030/**
3131 * Validates expressions.
@@ -295,19 +295,17 @@ export default class ExpressionValidator implements AstValidator<Expression> {
295295 }
296296
297297 private isValidOperandType ( operand : Expression , supportedShapes : string [ ] ) : boolean {
298- const decl = operand . $resolvedType ?. decl ;
298+ let decl = operand . $resolvedType ?. decl ;
299+ if ( isAliasDecl ( decl ) ) {
300+ // If it's an alias, we check the resolved type of the expression
301+ decl = decl . expression ?. $resolvedType ?. decl ;
302+ }
299303
300304 // Check for valid type
301305 if ( typeof decl === 'string' ) {
302306 return supportedShapes . includes ( decl ) ;
303307 }
304308
305- // Check for valid AliasDecl
306- if ( isAliasDecl ( decl ) ) {
307- const mappedResolvedType = translateExpressionTypeToResolve ( decl . expression ?. $type ) ;
308- return supportedShapes . includes ( mappedResolvedType ) ;
309- }
310-
311309 // Any other type is invalid
312310 return false ;
313311 }
0 commit comments