Skip to content

2.2.2 breaks enums in GTS files #65

Description

@Techn1x

First mentioned here #38 (comment)

If an enum is defined and used in a component (within the same file)

// app/components/alert.gts
export enum AlertType {
  Information = 'information',
  Warning = 'warning',
  Critical = 'critical',
  Success = 'success',
  NewFeature = 'new-feature',
}

export component Alert: TOC = <template>
  {{#if (eq @type AlertType.Warning)}}
    ...
  {{else if ...}}
    ...
  {{/if}}
</template>

produces runtime error

Uncaught (in promise) Error: Attempted to resolve a value in a strict mode template, but that value was not in scope: AlertType

However it will work if any of these changes are made;

  • if the enum is defined in some other file and imported in
  • if the enum is set as a property in the component, and that is used in the template

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions