diff --git a/packages/animations/browser/src/dsl/animation_ast_builder.ts b/packages/animations/browser/src/dsl/animation_ast_builder.ts index 4884072fc3..841bfd378b 100644 --- a/packages/animations/browser/src/dsl/animation_ast_builder.ts +++ b/packages/animations/browser/src/dsl/animation_ast_builder.ts @@ -96,7 +96,7 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor { if (def.type == AnimationMetadataType.State) { const stateDef = def as AnimationStateMetadata; const name = stateDef.name; - name.split(/\s*,\s*/).forEach(n => { + name.toString().split(/\s*,\s*/).forEach(n => { stateDef.name = n; states.push(this.visitState(stateDef, context)); }); diff --git a/packages/animations/browser/test/dsl/animation_trigger_spec.ts b/packages/animations/browser/test/dsl/animation_trigger_spec.ts index c541c09292..b88f450b72 100644 --- a/packages/animations/browser/test/dsl/animation_trigger_spec.ts +++ b/packages/animations/browser/test/dsl/animation_trigger_spec.ts @@ -203,6 +203,17 @@ import {makeTrigger} from '../shared'; ]); }); + it('should treat numeric values (disguised as strings) as proper state values', () => { + const result = makeTrigger('name', [ + state(1 as any as string, style({opacity: 0})), + state(0 as any as string, style({opacity: 0})), transition('* => *', animate(1000)) + ]); + + expect(() => { + const trans = buildTransition(result, element, false, true) !; + }).not.toThrow(); + }); + describe('aliases', () => { it('should alias the :enter transition as void => *', () => { const result = makeTrigger('name', [transition(':enter', animate(3333))]);