emberjs / emberjs/babel-plugin-ember-template-compilation

2.2.2 breaks enums in GTS files

Open
#65 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8
Forks
13
PR merge metrics
No merged PRs in 30d

Description

First mentioned here https://github.com/emberjs/babel-plugin-ember-template-compilation/issues/38#issuecomment-2384709391

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

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

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

```

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.