Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

app's TS files do not properly overwrite an addon's JS files

未关闭
#774 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
领域
frontend

调研方向

使用所示的 my-addon/addon 和 my-app/app TypeScript 与 JavaScript 文件重现组件覆盖,然后将其与可正常工作的 JavaScript 覆盖进行比较。跟踪应用组件相对于插件组件的解析过程,并确定 TypeScript 版本失败的原因。完成的标准是,TypeScript 应用组件和模板能够替换插件的 JavaScript 组件,同时保留 Glint 声明。

由索引模型根据 Issue 内容生成。

描述

I have the following example component in my addon:

my-addon/addon/components/example/index.ts

import templateOnly from '@ember/component/template-only';
export default templateOnly();
```hbs
**my-addon/addon/components/example/index.hbs**
Whatever ``` **my-addon/app/components/example/index.js** ```js export { default } from 'my-addon/components/loading'; ```

Then in my app I completely replace it with a new template AND "backing class" with some Glint because why not:
my-app/app/components/index.ts

import templateOnlyComponent from '@ember/component/template-only';

interface LoadingSignature {
  Element: HTMLElement; // <i>
}

const LoadingComponent = templateOnlyComponent<LoadingSignature>();
export default LoadingComponent;

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
    Loading: typeof LoadingComponent;
  }
}

my-app/app/components/index.hbs

<div>Whatever</div>

This does not work and throws the following error:
image

It does work when using a JS file to overwrite the component:
my-app/app/components/index.js

// I have lost all my Glint stuff, because it's a JS file :'(
import templateOnlyComponent from '@ember/component/template-only';
const LoadingComponent = templateOnlyComponent();
export default LoadingComponent;

my-app/app/components/index.hbs

<div>Whatever</div>
主要语言
JavaScript
星标
77
派生
65
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ember-cli/ember-cli-htmlbars 的其他 Issue

查看 ember-cli/ember-cli-htmlbars 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。